이상한 문제에 직면 해있는 것 같습니다. 랩톱 컴퓨터에서 PHP 스크립트를 사용하여 '곱슬 곱슬 함'을 사용하고 직장에서 완벽하게 작동합니다. 그러나 집에 있고 ISP에 연결되어있을 때 같은 스크립트가 데이터를 반환하지 못합니다. 다음과 같은 샘플 코드도 실패합니다.특정 네트워크에서 컬이 작동하지 않습니다.
$ch = curl_init("http://www.yahoo.com/");
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_exec($ch);
var_dump(curl_getinfo($ch));
curl_getinfo는 더 이상 디버깅 할 단서를 제공하지 않습니다. HTTP CODE는 0입니다. 헤더를 추가해야합니까>
브라우저를 통해 example.com에 액세스 할 수 있으므로 네트워크 문제는 없습니다. curl_err 및 curl_errno가 null입니다.
<pre>
array (size=22)
'url' => string 'http://www.example.com/' (length=23)
'content_type' => null
'http_code' => int 0
'header_size' => int 0
'request_size' => int 0
'filetime' => int -1
'ssl_verify_result' => int 0
'redirect_count' => int 0
'total_time' => float 0
'namelookup_time' => float 0
'connect_time' => float 0
'pretransfer_time' => float 0
'size_upload' => float 0
'size_download' => float 0
'speed_download' => float 0
'speed_upload' => float 0
'download_content_length' => float -1
'upload_content_length' => float -1
'starttransfer_time' => float 0
'redirect_time' => float 0
'certinfo' =>
array (size=0)
empty
'redirect_url' => string '' (length=0)
</pre>
null
null
'curl_error()'와'curl_errno()'를 사용하십시오. – Ohgodwhy
서버 액세스 권한이있는 경우 먼저 서버에서 URL을 찾아보십시오. 서버가 사이트에 연결하는 것을 허용하지 않을 수 있습니다. –
[Fiddler] (http://www.telerik.com/fiddler) (간단한 웹 디버거) 또는 [WireShark] (https://www.wireshark.org/) (고급 네트워크 경청자). 아마도 네트워크 문제 일 수도 있습니다. 즉, 원격 서버가 사용자의 IP로부터의 액세스를 거부합니다. – Kleskowy