note 82300 deleted from function.curl-setopt by sobak

From: Date: Wed, 06 May 2015 04:15:50 +0000
Subject: note 82300 deleted from function.curl-setopt by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-202451@lists.php.net to get a copy of this message
Note Submitter: john factorial ---- Clarification for the CURLOPT_NOBODY option: by excluding the body from your request, you're effectively making a HEAD request. Use the CURLOPT_NOBODY option to return only the headers in the remote response. Example: <?php function check_url($url) { $c = curl_init(); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_HEADER, 1); // get the header curl_setopt($c, CURLOPT_NOBODY, 1); // and *only* get the header curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // get the response as a string from curl_exec(), rather than echoing it curl_setopt($c, CURLOPT_FRESH_CONNECT, 1); // don't use a cached version of the url if (!curl_exec($c)) { return false; } $httpcode = curl_getinfo($c, CURLINFO_HTTP_CODE); return ($httpcode < 400); } ?>

« previous php.notes (#202451) next »