Possible Duplicate:
How to parse and process HTML with PHP?
I am brand new to php, only a couple of hours in, trying to understand searching and finding. Let's say I want to extract the rank of Diablo 3 from Amazon's top seller list here. There I can search for the string "Diablo III" or similar to find the following block (sorry about the formatting):
http://www.amazon.com/Diablo-III-Standard-Edition-Pc/dp/B00178630A/ref=zg_bs_4924894011_1
"><img src="http://ecx.images-amazon.com/images/I/41kXCp%2BUyeL._SL160_SL160_.jpg" alt="Diablo III: Standard Edition" title="Diablo III: Standard Edition" onload="if (typeof uet == 'function') { uet('af'); }"/></a></div></div><div class="zg_itemRightDiv_normal"><div class="zg_rankLine"><span class="zg_rankNumber">1.</span><span class="zg_rankMeta"></span></div><div class="zg_title"><a href="
http://www.amazon.com/Diablo-III-Standard-Edition-Pc/dp/B00178630A/ref=zg_bs_4924894011_1
">Diablo III: Standard Edition</a></div><div class="zg_byline">by Blizzard Entertainment
Now, I want to try to extract the rank, which is defined in this part <span class="zg_rankNumber">1.</span>
and is currently 1.
Could someone please advise on the best way on extracting that number so that if it falls to second, third or whatever place (up until 20) I will still be able to extract it?
I have looked a bit into preg_match and regex but I couldn't quite understand the use.