PHP cURL HTTP CODE return 0

前端 未结 9 1946
青春惊慌失措
青春惊慌失措 2020-11-29 23:03

I dont understand when I echo $httpCode I always get 0, I was expecting 404 when I change $html_brand into a broken url. Is there anything that I miss or do not know of? Tha

9条回答
  •  隐瞒了意图╮
    2020-11-29 23:23

    check the curl_error after the curl_getinfo to find out the hidden errors.

    if(curl_errno($ch)){   
        echo 'Curl error: ' . curl_error($ch);
    }
    

提交回复
热议问题