Possible Duplicate:
Easy way to test a URL for 404 in PHP?
I am using curl to download a sequence of pdfs from the backend in PHP. I do not know when the sequence ends like 1.pdf, 2.pdf......etc.
Below is the code I am using to download pdf:
$url = 'http://<ip>.pdf';
$path = "C:\\test.pdf";
$fp = fopen($path, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
fclose($fp);
But how do I determine that that pdf do not exists in the backend? Does curl returns any response when file not found?