Jump to content

file_exists problem


blufish

Recommended Posts

on the part of this code where it checks if file exists (which it does) it doesn't do what it's supposed to.

<?php
function showgarfield()
{
$month = $_GET['month'];
$year = $_GET['year'];
$syear = substr($year,-2);
echo 'http://images.ucomics.com/comics/ga/'.$year.'/ga'.$syear.$month.'31.gif';
if (file_exists('http://images.ucomics.com/comics/ga/'.$year.'/ga'.$syear.$month.'31.gif'))
{
echo 'http://images.ucomics.com/comics/ga/'.$year.'/ga'.$syear.$month.'31.gif';
}
}
showgarfield();
?>

Link to comment
https://forums.phpfreaks.com/topic/118214-file_exists-problem/
Share on other sites

<?php
$month = $_GET['month'];
$year = $_GET['year'];
$syear = substr($year,-2);
echo 'http://images.ucomics.com/comics/ga/'.$year.'/ga'.$syear.$month.'31.gif';
if (file_exists('http://images.ucomics.com/comics/ga/'.$year.'/ga'.$syear.$month.'31.gif'))
{
echo 'http://images.ucomics.com/comics/ga/'.$year.'/ga'.$syear.$month.'31.gif';
}
?>

I changed the code, it still doesn't work...

Link to comment
https://forums.phpfreaks.com/topic/118214-file_exists-problem/#findComment-608389
Share on other sites

change it to this to see what's the problem :

 

<?php
$month = $_GET['month'];
$year = $_GET['year'];
$syear = substr($year,-2);
echo 'http://images.ucomics.com/comics/ga/'.$year.'/ga'.$syear.$month.'31.gif';

$url = 'http://images.ucomics.com/comics/ga/'.$year.'/ga'.$syear.$month.'31.gif';
if (file_exists($url))
{
echo 'http://images.ucomics.com/comics/ga/'.$year.'/ga'.$syear.$month.'31.gif';
}
else
{
echo "this $url cant be found";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/118214-file_exists-problem/#findComment-608396
Share on other sites

 

I think so. Because PHP is a server side language and it knows nothing other than the server it is installed. So, I guess you cannot check whether any file exists in other PC using PHP.

Link to comment
https://forums.phpfreaks.com/topic/118214-file_exists-problem/#findComment-608404
Share on other sites

 

I think so. Because PHP is a server side language and it knows nothing other than the server it is installed. So, I guess you cannot check whether any file exists in other PC using PHP.

 

I'm not checking another PC I'm checking if an online file can be found.

Link to comment
https://forums.phpfreaks.com/topic/118214-file_exists-problem/#findComment-608405
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.