faqts : Computers : Programming : Languages : PHP : Common Problems : Files

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 16 people (69%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I verify the existence of a file on a remote server?

Jul 18th, 2001 09:16
syberchic, fabio martu, Ben Udall, http://www.php.net/manual/en/features.remote-files.php


As long as support for the "URL fopen wrapper" is enabled when you 
configure PHP (as it is by default) and set allow_url_fopen in the 
php.ini you can open files by http/ftp protocols and test their 
existence with the $file file pointer. 
eg.
  $file = fopen ("http://www.php.net/", "r");
  if (!$file) {
    echo "<p>Unable to open remote file.\n";
    exit;
  }