Kawyllainy Vi Kawyllainy Vi - 1 year ago 70
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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download