This is incredibly basic shit. The following is a top-down-no-classes-used example, using cURL, as suggested above. Note the lack of RETURNTRANSFER as we're only checking the status code.
Code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.site.com/blah/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch,CURLOPT_VERBOSE, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$pageData=curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
switch ($statusCode) {
case 404:
filemissing()...
break;
case 401:
authreq();
break;
default:
whatev();
}
Quote:
Originally Posted by nation-x
|
Do not use getimagesize() as a boolean for validation - that is VERY unsafe.