note 117740 added to function.curl-getinfo

From: Date: Fri, 31 Jul 2015 07:07:19 +0000
Subject: note 117740 added to function.curl-getinfo
Groups: php.notes 
Request: Send a blank email to php-notes+get-203230@lists.php.net to get a copy of this message
If you use curl option CURLOPT_NOBODY = true to test if distant url is available, any sites can send you an http code 400 like Cdiscount Wsdl : $ch = @curl_init($wsdl); if($ch === false) return false; @curl_setopt($ch, CURLOPT_HEADER ,true); // we want headers @curl_setopt($ch, CURLOPT_NOBODY ,true); // dont need body @curl_setopt($ch, CURLOPT_RETURNTRANSFER ,true); // catch output (do NOT print!) @curl_exec($ch); if(@curl_errno($ch)){ // should be 0 @curl_close($ch); return false; } $code = @curl_getinfo($ch, CURLINFO_HTTP_CODE); Modifying CURLOPT_NOBODY to false, http code sent is 200 otherwise http code is 400 !!! ---- Server IP: 72.52.91.14 Probable Submitter: 88.170.136.2 ---- Manual Page -- http://php.net/manual/en/function.curl-getinfo.php Edit -- https://master.php.net/note/edit/117740 Del: integrated -- https://master.php.net/note/delete/117740/integrated Del: useless -- https://master.php.net/note/delete/117740/useless Del: bad code -- https://master.php.net/note/delete/117740/bad+code Del: spam -- https://master.php.net/note/delete/117740/spam Del: non-english -- https://master.php.net/note/delete/117740/non-english Del: in docs -- https://master.php.net/note/delete/117740/in+docs Del: other reasons-- https://master.php.net/note/delete/117740 Reject -- https://master.php.net/note/reject/117740 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#203230) next »