This currently saves the RSS feed from the Twitter search to a .CSV file.Code:<?php header('Content-type: text/csv'); header('Content-Disposition: attachment; filename="tweets.csv"'); $tag = urlencode($_GET['tag']); $max_pages = $_GET['maxpages']; if ($max_pages > 50) { die("No way am i doing more than 50 pages. Sorry mate."); } echo 'name,date,uri,content' . "\r\n"; for($page = 1; $page <= $max_pages; $page++) { $url = "http://search.twitter.com/search.atom?&q={$tag}&rpp=100&page={$page}"; $xmlstr = file_get_contents($url); $xml = new SimpleXMLElement($xmlstr); foreach ($xml->entry as $entry) { $twitterdate = $entry->updated; $middle = " "; $half = (int) ( (strlen($twitterdate)) ); // cast to int incase str length is odd $left = substr($twitterdate, 0, $half); $right = substr($twitterdate, $half); $unixdate = strtotime($left); $correctdate = date("d-m-Y H:i", $unixdate); echo $entry->author->name . "," . $correctdate . "," . $entry->author->uri . ",\"" . strip_tags($entry->content) . "\" \r\n"; } }
I'd like to not only allow the file to be downloaded but also get it saved to the server. How can I generate the file and once generated post it to the server?
*****Please excuse my horrible date functions!!!!!!



LinkBack URL
About LinkBacks
Reply With Quote



