【发布时间】:2012-04-15 21:02:50
【问题描述】:
我想解析不需要身份验证的http://gmmobile.atm-mi.it/wsbw/InfoTraffico/ 页面。然而,当我尝试通过 PHP 脚本访问它以解析其内容时,我收到一个错误:
警告:file_get_contents(http://gmmobile.atm-mi.it/wsbw/InfoTraffico/) [function.file-get-contents]:打开流失败:HTTP 请求失败!第 70 行 /iPhone/simplehtmldom_1_5/simple_html_dom.php 中的 HTTP/1.1 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++;
}
可能是什么问题,我该如何解决?
【问题讨论】:
标签: php html html-parsing simple-html-dom