我想寫一個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