2012-04-02 3 views
0

인증을 필요로하지 않는 http://gmmobile.atm-mi.it/wsbw/InfoTraffico/ 페이지를 구문 분석하고 싶습니다.PHP 스크립트에서 페이지에 액세스 할 때 Funny 500 오류가 발생했습니다.

include('simple_html_dom.php'); 
// Create DOM from URL or file 
$url='http://gmmobile.atm-mi.it/wsbw/InfoTraffico/'; 
echo $url; 
$html = file_get_html($url); 
echo $html; 
$i=0; 
foreach($html->find('option') as $content) 
{ 
    $linea=$content->value; 
    $destination=$content->title; 
     $i++; 

} 

것은 무엇 일 수 있습니다

Warning: file_get_contents(http://gmmobile.atm-mi.it/wsbw/InfoTraffico/) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in /iPhone/simplehtmldom_1_5/simple_html_dom.php on line 70

내가 사용하고있는 코드는 다음입니다 : 나는 그것의 내용을 분석하기 위해 PHP 스크립트를 통해 액세스 할 때 그러나, 나는 오류가 발생 문제는 어떻게 해결할 수 있습니까?

답변

0

시도는 사용자 에이전트를 추가합니다 :

$url = 'http://gmmobile.atm-mi.it/wsbw/InfoTraffico/'; 
$options = array('http' => array('header' => "User-Agent: myFooAgent\r\n")); 
$context = stream_context_create($options); 
echo file_get_contents($url, false, $context); 
+0

덕분에, 나는 제안을 살펴해야합니다. –

+0

많은 분들께 감사드립니다. 신속하게 구현하지 못해 죄송합니다.하지만 다른 문제를 해결해야하며 구현하고 싶은 앱이 이미 완료되었음을 발견했습니다. –

+0

질문을 닫아야합니다. –

관련 문제