Log in

View Full Version : Copying Text from another site



tgallagher26
02-26-2009, 01:35 PM
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..

Medyman
02-26-2009, 02:23 PM
The trends page has a Atom feed (http://www.google.com/trends/hottrends/atom/hourly). 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.

tgallagher26
02-26-2009, 02:27 PM
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..

Medyman
02-26-2009, 02:36 PM
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.

tgallagher26
02-26-2009, 02:45 PM
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..

Medyman
02-26-2009, 03:24 PM
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() (http://us.php.net/strip-tags) function to take all of the HTML out. That'll leave you with just the search terms. This article (http://nadeausoftware.com/articles/2007/09/php_tip_how_strip_html_tags_web_page) has more on this.

tgallagher26
02-26-2009, 03:50 PM
I dont understand how to do any of this.

Tim..

Medyman
02-26-2009, 04:05 PM
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.

tgallagher26
02-26-2009, 10:06 PM
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..