我想写一个PHP脚本来从www.snowbird.com/mountain-report/拉雪和其他数据通过LED阵列显示。我在获取需要的数据方面遇到麻烦。我似乎无法找到使其工作的方法。我能做这项工作吗?还是我需要去使用另一种语言?PHP curl从网站返回空数组的数据
以下代码仅返回空白。在代码之后,我会发布返回的内容。
require('simple_html_dom.php');
$ch = curl_init("http://www.snowbird.com/mountain-report/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$content = curl_exec($ch);
curl_close($ch);
$html = new simple_html_dom();
$html->load($content);
$ret1 = $html->find('.snowfall-total');
print_r ($ret1);
$ret2 = $html->find('#twenty-four-hour');
print_r ($ret2);
$ret3 = $html->find('#forty-eight-hour');
print_r ($ret3);
$ret4 = $html->find('#current-depth');
print_r ($ret4);
$ret5 = $html->find('#year-to-date');
print_r ($ret5);
?>
这里是输出
[email protected] /var/www $php test4.php
Array
(
)
Array
(
)
Array
(
)
Array
(
)
Array
(
)
2015-11-10
knilssen