note 84510 added to function.curl-getinfo

From: Date: Thu, 17 Jul 2008 07:40:59 +0000
Subject: note 84510 added to function.curl-getinfo
Groups: php.notes 
Request: Send a blank email to php-notes+get-141603@lists.php.net to get a copy of this message
CURLINFO_CONTENT_LENGTH_DOWNLOAD contains zero in FTP request although Content-Length field is present. Following workaround may helps: <?php $ch = curl_init($url); ... CURL OPTIONS ... $result=curl_exec($ch); $pu=parse_url($url); if($pu['scheme']=='ftp'){ $regexp="/Content-Length: (\d*)/"; preg_match($regexp,$result,$matches); $con_len=$matches[1]; } else $con_len = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); ?> Its worth to keep using CURLINFO_CONTENT_LENGTH_DOWNLOAD in http requests, becouse there could be several headers pack if CURLOPT_FOLLOWLOCATION is fired, and regular expression for this case is a little bit complicated. ---- Server IP: 91.196.196.241 Probable Submitter: 82.144.200.149 ---- Manual Page -- http://www.php.net/manual/en/function.curl-getinfo.php Edit -- https://master.php.net/note/edit/84510 Del: integrated -- https://master.php.net/note/delete/84510/integrated Del: useless -- https://master.php.net/note/delete/84510/useless Del: bad code -- https://master.php.net/note/delete/84510/bad+code Del: spam -- https://master.php.net/note/delete/84510/spam Del: non-english -- https://master.php.net/note/delete/84510/non-english Del: in docs -- https://master.php.net/note/delete/84510/in+docs Del: other reasons-- https://master.php.net/note/delete/84510 Reject -- https://master.php.net/note/reject/84510 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141603) next »