note 47947 deleted from function.file-get-contents by nlopess

From: Date: Mon, 06 Dec 2004 21:32:06 +0000
Subject: note 47947 deleted from function.file-get-contents by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-81457@lists.php.net to get a copy of this message
Note Submitter: chphilli at NOSPAM dot gmail dot com ---- I am working on a simple script to poll a set of rss feeds to create a list of most recently updated websites. The idea is simple, and works well, but is extremely slow. Can anyone think of a way to speed up the process? The slowdown really seems to be in using file_get_contents to get the rss-feed itself. <?php //get the rss feed for each site, and parse out the date of the first //(most recent) entry (marked by <item>). //then change the date into a unix epoch time (seconds since 1/1/1970) for($i = 0; $i < $count; $i++) { //the next line is necessary if you are using a file for input //$sites[$i] = rtrim($sites[$i]); $rss_feed = file_get_contents("$rss_pre" . $sites[$i]); $rss_feed = strstr($rss_feed, "<item>"); $date_str = remover($rss_feed, "<title>", "</title>"); sscanf($date_str, "%d/%d/%d %d:%d:%d: %s", $m, $d, $y, $h, $n, $s, $c); if($c = "PM") { $h = $h + 12; } $dates[$i] = mktime($h, $n, $s, $m, $d, $y); }

« previous php.notes (#81457) next »