PHP Check whether URL exists with CURL
PHP Check whether URL exists with CURL
PHP Check whether URL exists with CURL
This script helps us to check whether a URL exist or not by checking the header details.Here we are also displaying the output of the URL header details for further reference.
You might also be interested in this tutorial Get Web Page Content Using PHP CURL
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://localhost/lic/upload.php"); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_NOBODY, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = curl_exec($ch); curl_close($ch); echo $data;
Sample output
HTTP/1.1 200 OK Date: Fri, 04 Jan 2013 14:25:55 GMT Server: Apache X-Powered-By: PHP/5.3.1 Content-Type: text/html