Made it cope with “accept-encoding” more properly
This commit is contained in:
parent
8cf8c416ed
commit
f7c32d00ef
1 changed files with 2 additions and 3 deletions
|
@ -12,12 +12,11 @@ function getfc($url,$timeout,$headers=[]) {
|
|||
curl_setopt($curli,CURLOPT_CONNECTTIMEOUT,$timeout);
|
||||
curl_setopt($curli,CURLOPT_HTTPHEADER,$headers);
|
||||
curl_setopt($curli,CURLOPT_HEADER,true);
|
||||
curl_setopt($curli,CURLOPT_ENCODING,'');
|
||||
$cont=curl_exec($curli);
|
||||
$headers_sz=curl_getinfo($curli,CURLINFO_HEADER_SIZE);
|
||||
$headers=substr($cont,0,$headers_sz);
|
||||
$headers=strtolower(substr($cont,0,$headers_sz));
|
||||
$cont=substr($cont,$headers_sz);
|
||||
if (preg_match('/^Content-Encoding: gzip/m',$headers)===1)
|
||||
$cont=gzdecode($cont);
|
||||
$emsg=false;
|
||||
$cerrno=curl_errno($curli);
|
||||
if ($cerrno>0) {
|
||||
|
|
Loading…
Reference in a new issue