file_get_contents와 함께 파일 ("http://feeds.artistdata.com/xml.shows/artist/AR-YX458DZO75EQACZ3/xml")을로드하려고하는데 5-10 초 내에 오류가 발생합니다. xml 파일은 브라우저에서 잘로드되며, 위의 URL 끝에 "/ future"를 추가하면 더 작은 버전을 사용하면 file_get_contents로 잘로드됩니다.PHP file_get_contents가 "스트림을 열지 못했습니다 : HTTP 요청에 실패했습니다!" 대용량 XML 파일에 액세스 할 때 5-10 초 내에
스크립트는 다음 두 가지 오류의
$file = "http://feeds.artistdata.com/xml.shows/artist/AR-YX458DZO75EQACZ3/xml";
$data = file_get_contents($file);
하나는 표시, 다음 중 하나를
Warning: file_get_contents("http://feeds.artistdata.com/xml.shows/artist/AR-YX458DZO75EQACZ3/xml") [function.file-get-contents]: failed to open stream: HTTP request failed! in MY_PHP_SCRIPT.php on line 2
또는 :
Warning: file_get_contents("http://feeds.artistdata.com/xml.shows/artist/AR-YX458DZO75EQACZ3/xml") [function.file-get-contents]: failed to open stream: Connection timed out in MY_PHP_SCRIPT.php on line 2
어떤 아이디어가? 내가 using cURL instead을 시도했지만, 그럴 때 "Error on line 1"이 표시됩니다. 오류는 10 초 이내에 나타나므로 기본값은 앱에 따라 일반적으로 15 초 또는 30 초이므로 시간 초과 문제라고는 상상할 수 없습니다.
방화벽을 사용하고 있습니까? – Arjan
표시 한 링크에서 cURL을 사용한 경우 - 변경 했습니까? curl_setopt ($ curl_handle, CURLOPT_CONNECTTIMEOUT, 2); to : curl_setopt ($ curl_handle, CURLOPT_CONNECTTIMEOUT, 15); ? – alfasin