RE: [PHP] url exist?

2001-11-15 Thread Andrew Kirilenko

Hello!

The simpliest way:
$f = @fopen(http://foobar.baz/somefile.ext;, r);
if ($f)
{
fclose($f);
echo exists!
}
else
{
echo no exists!
}

Best regards,
Andrew Kirilenko.

 -Original Message-
 From: jtjohnston [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 16, 2001 9:16 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] url exist?
 
 
 Any way of finding out if this exists?
 
 http://www.somewhere.com/image.jpg
 
 if yes {} else {};
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] url exist?

2001-11-15 Thread Chris Hobbs

Looks like you might be able to use the cURL extensions 
http://www.php.net/manual/en/ref.curl.php - there's a function called 
curl_getinfo which returns an array which includes http_code - you could 
check the value of that to see whether the file was available (http_code 
== 200), not found (http_code == 404), or whatever 
(http://www.w3.org/Protocols/HTTP/HTRESP.html).

Have fun!

jtjohnston wrote:

Any way of finding out if this exists?

http://www.somewhere.com/image.jpg

if yes {} else {};





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] url exist?

2001-11-15 Thread jtjohnston

Thanks.

Andrew Kirilenko wrote:

 Hello!

 The simpliest way:
 $f = @fopen(http://foobar.baz/somefile.ext;, r);
 if ($f)
 {
 fclose($f);
 echo exists!
 }
 else
 {
 echo no exists!
 }

 Best regards,
 Andrew Kirilenko.

  -Original Message-
  From: jtjohnston [mailto:[EMAIL PROTECTED]]
  Sent: Friday, November 16, 2001 9:16 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] url exist?
 
 
  Any way of finding out if this exists?
 
  http://www.somewhere.com/image.jpg
 
  if yes {} else {};
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] url exist?

2001-11-15 Thread jtjohnston

Yeah ... but you have to install the package. Thanks for the thought
though. :) I'd looove to ask my admin ... but I know what his answer
is/was/will be/would be :) always is.

Chris Hobbs wrote:

 Looks like you might be able to use the cURL extensions
 http://www.php.net/manual/en/ref.curl.php - there's a function called
 curl_getinfo which returns an array which includes http_code - you could
 check the value of that to see whether the file was available (http_code
 == 200), not found (http_code == 404), or whatever
 (http://www.w3.org/Protocols/HTTP/HTRESP.html).

 Have fun!

 jtjohnston wrote:

 Any way of finding out if this exists?
 
 http://www.somewhere.com/image.jpg
 
 if yes {} else {};
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]