Ok so here it goes I am trying to save the top 100 search terms to a txt file
Here is the code I am tying to use.
The problem I am having is that its only saving the 100th term also it doesnt save it on a new line.PHP Code:<?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;
}
}
$file = 'top100.txt';
$current = file_get_contents($file);
$current .= $urltext;
file_put_contents($file, $current);
?>
The are the pages
List I am trying to save (Its upated Hourly)
Print page (Code above is here)
Text file (Trying to Save here)
Any help would be appreciated.
TIm..



Reply With Quote
Bookmarks