/ Published in: PHP
This function will use curl to see if a file exists at the location it's provided. It accepts $_path as a parameter.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function file_alive($_path) { if (false === $handle) {return false;} curl_setopt($handle, CURLOPT_HTTPHEADER, Array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15") ); // request as if Firefox because some sites request a valid header from you return $alive; }