PHP Simple HTML DOM Parser starts at item number 2 instead of number 1
-
02-06-2021 - |
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!
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