PHP curl从网站返回空数组的数据

I am trying to write a Php Script to pull snow and other data from www.snowbird.com/mountain-report/ to display via an led array. I am having troubles with getting the data I need. I can't seem to be able to find a way to make it work. Would I be able to make this work, or would I have to go about and use a different language?

The following code only return empty. Following the code I will post what is returned.

<?php
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);
?>

Here is the output

pi@KPi /var/www $php test4.php

Array
(
)
Array
(
)
Array
(
)
Array
(
)
Array
(
)
查看全部
dongtan6543
dongtan6543
2015/11/10 08:36
  • curl
  • php
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

3个回复