file_exists and is_file always false
Date: 02/19/05
(PHP Community) Keywords: database
Please help me with this, I'm trying to create a handler for a 404 error, and i feel like I'm close, but my if statement always returns a false. Code below cut
$user = "MHeath81";
$filename = "http://ws.audioscrobbler.com/rdf/history/$user";
if (is_file($filename)) {
$fp = fopen($filename, "r");
}
else {
Header("Content-type: image/jpeg");
$im = imageCreateFromJPEG("scrobbler.jpg");
$m1 = "Last track played:";
$nomessage = "Tracks database currently unavailable";
$red = ImageColorAllocate($im, 249, 79, 79);
$white = ImageColorAllocate($im, 0, 0, 0);
ImageString($im,2,5,1,$m1,$red);
ImageString($im,3,11,95,$nomessage,$white);
ImageString($im,3,10,94,$nomessage,$red);
ImageJPEG($im, '', 90);
ImageDestroy($im);
}
Any help greatly appreciated, I feel like I'm missing something really stupid, it could even be the way I'm accessing the file using is_file or file_exists.
Source: http://www.livejournal.com/community/php/262722.html