|
Posted by Jon on 09/06/05 17:55
All,
I'm currently working on implementing an RSS-Feed reader for a website
I'm working on, and am having troubles. At this point, I'm using a
function to get an RSS feed for display on my site - The feed comes in,
and I'm trying to store the actual file into a temporary location on the
server. Problem is, I can't seem to get this working. Most of this comes
from a tutorial I have on this, so the code's reliability is marginal at
best. According to the book, this should work to store the file and read
from it:
$tmp = "rssTesting/tempSpace".$feedname."_tmp.rdf";
$expires=time()-3600;
if(!$feed){
die("Feed doesn't exist");
}
if(!file_exists($tmp) or filemtime($tmp)<$expires){
@copy($feed, $tmp) or die("File Copy failed - File doesn't exist!");
}
$xml="";
$filehandle = @fopen($tmp, "r") or die("Cannot open file from
tempSpace: Operation failed");
while(!feof($filehandle)){
$xml.=fread($filehandle, 4096);
}
fclose($filehandle);
After this code, it parses out the XML for display back to the browser.
The actual function call looks like this:
$a=getFeed("http://www.spacetoday.net/summaries.rdf","spacetoday",2);
Heading looks like this (is it called heading in PHP? I'm kind of from
C++ here):
function getFeed($feed, $feedname, $no)
$no is the number of lines I want to display at a time and $feed can be
any RSS feed.
Basically, the file never gets created, and I get the 'File Doesn't
Exist!' error any time I call the function. I even set all permissions
in the directory and parent directory to 777 to make sure I wasn't
jacking up the permissions.
Any ideas on what I'm missing here? Thank you in advance
Navigation:
[Reply to this message]
|