[Regex] Extracting multiple ocurrences from a page?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


I need to extract multiple occurends of the same type of item from a
web page. The part I need looks like


... without the quotes, and add each found item into an associative
array stuff[$code] by adding a comma and the new item.

I'm not used to using regexes with PHP (5, FWIW), and am a bit lost at
how to do this. Should I use eregi()? preg_match_all? Something else?
And how to do this?

Here's the code:
$stuff = file_get_contents("http://localhost/stuff.html");

if(eregi("Nothing found.",$stuff)) {
    echo "Nothing found.";
} else {

    if (eregi("id=[0-9]+",$stuff)) {
        preg_match_all ("|id=(\d+)|", $stuff, $out,

        //How to extract item from $out[]?
        stuff[$code] = stuff[$code] . "," . $out[1][1];


Thank you!

Site Timeline