Results 1 to 1 of 1

Thread: Need PHP Help.

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

    Default Need PHP Help.

    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.

    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 problem I am having is that its only saving the 100th term also it doesnt save it on a new line.

    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..
    Last edited by tgallagher26; 03-23-2009 at 06:28 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
  •