You are here: Temp File help « PHP Language « IT news, forums, messages
Temp File help

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация