Results 1 to 9 of 9

Thread: Copying Text from another site

  1. #1
    Join Date
    Feb 2009
    Posts
    62
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Copying Text from another site

    OK so I have a website KyWordPRO.com which is just a meta search engine for the most part.

    So I want to create a top 100 page with links for my site from http://www.google.com/trends/hottrends?sa=X

    Google is updated about every hour so I just cant copy and paste for the most current results. Googles top 100 has 4 colums and I want it displayed on my site as just 2 colums of 50.

    Can anyone help me with this?

    Tim..

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    The trends page has a Atom feed. You could parse it with a server-side language and get the list that way.

    This would require a pretty good knowledge of regular expressions. That's not one of my strong suits so I can't actually help code-wise. Maybe someone else can help more.

  3. #3
    Join Date
    Feb 2009
    Posts
    62
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    Yea but the link all link to Google.

    I want the results to search my site not Google.

    So each top search query would need to be linked to my site.

    Tim..

  4. #4
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Right...

    You would harvest the top trends from the Atom feed and then create your own links. Do you have a way to enter query strings via URL?

    So, you would parse the feed, strip out the HTML and end up with just the phrases. Then loop over those phrases and create the links yourself.

  5. #5
    Join Date
    Feb 2009
    Posts
    62
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    I am not sure how to do any of this but this would be the link.

    http://kywordpro.com/txt/1/10/{search query}.html

    Tim..

  6. #6
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    That's a really weird setup. Why the .html at the end?

    In any case, are you able to use PHP? You would first parse the Atom feed. You can do this via JS and then pass the string to PHP. Or, there are PHP libraries for that sort of thing (Google around).

    Next, use PHP's strip_tags() function to take all of the HTML out. That'll leave you with just the search terms. This article has more on this.

  7. #7
    Join Date
    Feb 2009
    Posts
    62
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    I dont understand how to do any of this.

    Tim..

  8. #8
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    In that case, you should contact a developer to help you with this. There are paid-work request forums here. You might also find getafreelancer.com helpful for these kind of simple, one-off jobs.

  9. #9
    Join Date
    Feb 2009
    Posts
    62
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    Ok so I have been working alittle on this now and found this

    <OL>

    <?php
    $feed = simplexml_load_file('http://www.google.com/trends/hottrends/atom/hourly');
    $children = $feed->children('http://www.w3.org/2005/Atom');
    $parts = $children->entry;
    foreach ($parts as $entry) {
    $details = $entry->children('http://www.w3.org/2005/Atom');
    $dom = new domDocument();
    @$dom->loadHTML($details->content);
    $anchors = $dom->getElementsByTagName('a');
    foreach ($anchors as $anchor) {
    $url = $anchor->getAttribute('href');
    $urltext = $anchor->nodeValue;
    echo '<LI><a href="http://kywordpro.com/txt/1/10/' . $urltext . '.html" target="blank">' . $urltext . '</a><br /> ';
    }
    }
    ?>

    </OL>


    I worked with it alittle to make it pull the info like I wanted it to.
    You can look at it at http://kywordpro.com/top100.php.

    It still needs some worksince I want two colums of 50 instead of one colum of 100.
    Can anyone help?

    Tim..
    Last edited by tgallagher26; 02-26-2009 at 10:29 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •