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
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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.