从另一个站点捕获特定元素并显示


catch a specific element from another site and display

如何获得页面上的特定元素并显示另一个元素?

我有这个页面http://www.supercounters.com/stats/1214936,我想得到这个值:

<td 'class="span-5 visitortd">5,582 Visits</td>

并显示在我的页面..

像这样:

Out: 5,582 Yesterday Visits

实际代码:

$html = file_get_html('http://www.supercounters.com/stats/1214936');
foreach($html->find('table') as $element) 
       echo $element->td . '<br>';

是我第一次尝试这样做,目前的代码不是很好,我认为我们需要补充

需要的数据在$html->find('td')中。标签名不成为属性,你必须使用$element->find()来访问不同的元素。

然后访问内容,需要使用$element->plaintext