Deanznet Posted December 9, 2010 Share Posted December 9, 2010 Okay the page is structed like this. lets says i have a http://site.com/sdsddsa And it shows the following <div class="data"> <div class="title"> <a class="title" href="http://www.site.com/product/dp/ITEMID/ref=sr_1_1?s=automotive&ie=UTF8&qid=1291906958&sr=1-1">ITEM ID</a> </div> <div class="newPrice"> <a href="http://www.site.com/product/dp/ITEMID/ref=sr_1_1?s=automotive&ie=UTF8&qid=1291906958&sr=1-1" > Buy new</a>:<span class="price"> $12.95</span> </div><br class="unfloat"> <div class="usedNewPrice"> <span class="subPrice"> <a href="http://www.site.com/product/dp/ITEMID/ref=sr_1_1?s=automotive&ie=UTF8&qid=1291906958&sr=1-1">2 new</a> from <span class="price">$12.95</span></span> <br class="unfloat"> </div> <div class="fastTrack"> <span class="getItBy">Get it by <span class='deliveryDate'>Friday, Dec 10</span></span> if you order in the next <span class='timeLeft'>8 hours</span> and choose one-day shipping.</div> <div class="sss"> Eligible for <span class="sssFree">FREE</span><span class="sssLastLine"> Super Saver Shipping.</span> </div> <div class="lowStock"> Only 3 left in stock - order soon.</div> </div> </div> And it repeated again! I need the ITEMID number from the LISTING and the Price for the item ID number. Can anyone help please! Quote Link to comment https://forums.phpfreaks.com/topic/221121-php-grabing-stuff-from-a-html-page/ Share on other sites More sharing options...
o3d Posted December 9, 2010 Share Posted December 9, 2010 A very rough approach could be to put each <div class="data"> section into an array and then go through that array and find ITEMID. <?PHP $page_content_array = explode('<div class="data">', $page_contents); for ($i=0; $i<count($page_content_array); $i++) { $content_array = explode('/', $page_content_array[$i]); $content_array[5]; //this should contain the ITEMID for every <div class="data"> section } ?> this has not been tested Quote Link to comment https://forums.phpfreaks.com/topic/221121-php-grabing-stuff-from-a-html-page/#findComment-1145044 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.