I need to parse this HTML code into an array of strings, so I can then add it into a database. Here is the HTML code I am parsing:
http://gyazo.com/eab3a140264d354060268a97ae8fa6de
The class "market_listing_table_header" at the top seems to be defining what the rest of the page will display. The class "market_listing_row_link" is 1 of 100, but I also get 40 more sets of lists of 100.
What I need is in this "Souvenir Desert Eagle | Hand Cannon (Well Worn)" section for each of these classes, which is in the "market_listing_item_name_block". The "result_0_name" goes from that to "result_100_name" then starts again at 0 for the ~4000 listings on the page.
If possible I would also like to get the src="get this link" in the "result_0_image" section to go with the "result_0_name".
This is the code I'm using now:
$str = '$html';
$DOM = new DOMDocument;
$DOM->loadHTML($str);
$items = $DOM->getElementsByTagName('market_listing_item_block');
//just displaying the items for now, for testing,
//though I may need help putting the data in an array as well.
for ($i = 0; $i < $items->length; $i++)
echo $items->item($i)->nodeValue . "<br/>";
I have added different code in the "getElementsByTagName('???');" section, but I can't work out what it should be to get the section that I want. Any help would be great, thanks.