Kawyllainy Vi Kawyllainy Vi - 6 months ago 17
PHP Question

catch a specific element from another site and display

How can I get a specific element on a page and show another?

I have this page http://www.supercounters.com/stats/1214936, i want to get this value:

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

And show in my page..

Like this :

Out: 5,582 Yesterday Visits

Actual code :

$html = file_get_html('http://www.supercounters.com/stats/1214936');

foreach($html->find('table') as $element)
echo $element->td . '<br>';

is the first time I'm trying to do this, and the current code is not working very well , I think we need to complement


The data you want is in $html->find('td'). Tag names don't become properties, you have to use $element->find() to access different elements.

Then to access the contents, you need to use $element->plaintext.