Question

i'm using Simple HTML DOM Parser to receive certain info that i require, but it seems like the parser outputs the 1st. item it finds. I'm using this code:

$html = file_get_html("http://steamcommunity.com/id/" . $username . "/wishlist/");
foreach($html->find('.wishlistRow') as $e)
{
$item = $e->outertext;
}
echo $item;

this outputs the 2nd item on the wishlist, but not the first. This also applies to other projects i'm working on, and i would really appreciate any help I can get!

Was it helpful?

Solution

echo is out of the foreach, so it will only output the last item. Move it inside foreach.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top