Need to get a div's content from multiple sites

TasiaVarney

New Member
I would like to grab the prices of products from newegg. heres an example site\[code\]http://www.newegg.com/Product/Product.aspx?Item=**N82E16820167027**\[/code\]from this site, i would like to get the content of \[code\]<div class="grpPricing">\[/code\], that contains the price.im not very skilled at making codes, so i was searching the web for codes and used it as an example to make my own... heres the result so far:\[code\] function getprice($itemId) { $source=trim("http://www.newegg.com/Product/Product.aspx?Item=".$itemId); preg_match("'<div class=\"grpPricing\">(.*?)</div>'si", $source, $match); if($match) echo "result=".$match[1]; }\[/code\]\[code\]$itemId\[/code\] is given, this is how i can make a script that loops through multiple newegg products and gets the needed infoNOTE: it wont let me post the code as it really should be, dont know why, maybe because im not registered?!and theres another issue that i cant solve... the output of the code should be:\[code\]return strip_tags($price);\[/code\]simply because later i would call the function with this line\[code\]$price=getprice($row['newegg_productid']);\[/code\]ive tried my best to explain clearly, but let me know if you have trouble understanding. any help is much appreciated, thanks!
 
Back
Top