hi
I would like to grab the prices of products from newegg. heres an example site
http://www.newegg.com/Product/Product.aspx?Item=**N82E16820167027**
from this site, i would like to get the content of <div class="grpPricing">
, 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:
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];
}
$itemId
is given, this is how i can make a script that loops through multiple newegg products and gets the needed info
NOTE: 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:
return strip_tags($price);
simply because later i would call the function with this line
$price=getprice($row['newegg_productid']);
ive tried my best to explain clearly, but let me know if you have trouble understanding. any help is much appreciated, thanks!