All CURL functions returns null in php -
php5-curl installed curl_exec()
returns null
, curl_errno()
returns 0
, curl_error()
returns null
, curl_getinfo()
looks curl_exec()
never fired.
sample of code
$this->curl = curl_init(); $agent = 'mozilla/5.0 (windows nt 6.1; wow64; rv:52.0) gecko/20100101 firefox/52.0'; $curloptions = array( curlopt_url=>str_replace(' ', '%20', $url), curlopt_returntransfer=>true, curlopt_useragent=>$agent, curlopt_binarytransfer=>true, curlopt_customrequest=>"get", curlopt_autoreferer=>true, curlopt_connecttimeout=>5, curlopt_timeout=>600, curlopt_followlocation=>true, curlopt_maxredirs=>20, curlopt_ssl_verifypeer=>false ); curl_setopt_array($this->curl, $curloptions); $result = curl_exec($this->curl); $status = curl_getinfo($this->curl); $this->log->tolog('http error on downloading ' .$url.' ; error = ' . curl_errno($this->curl) . " => ". curl_error($this->curl) . ' ; status = '. json_encode($status) , 'info');
in log can see
http error on downloading
https://cdn-a.verkkokauppa.com/576/images/83/2_175586-1250x758.jpeg
; error = 0 => ; status = {"url":"https://cdn-a.verkkokauppa.com/576/images/83/2_175586-1250x758.jpeg","content_type":null,"http_code":0,"header_size":0,"request_size":0,"filetime":0,"ssl_verify_result":0,"redirect_count":0,"total_time":0,"namelookup_time":0,"connect_time":0,"pretransfer_time":0,"size_upload":0,"size_download":0,"speed_download":0,"speed_upload":0,"download_content_length":-1,"upload_content_length":-1,"starttransfer_time":0,"redirect_time":0,"redirect_url":"","primary_ip":"","certinfo":[],"primary_port":0,"local_ip":"","local_port":0}
but file_get_contents()
works fine in case. happened? how can fix it?
Comments
Post a Comment