MY SCRIPT: Here is the PHP code I created for my more.php pages to dynamically scrape xbox product prices from GameStop.com:
//<--start Paul's PHP Gamestop Scrape function-->//
$symbol=''. $v[ProductName] .'';
echo "COMPARE PRICES on $symbol <br /><br />";
$varlength = strlen($symbol);
$limit = 16;
if ($varlength > $limit) {
$symbol = substr($symbol,0,$limit) . "";}
echo "Gamestop.com: ";
if (!($fp = fopen($theurl, 'r')))
{
echo 'Could not open URL';
exit;
}
$contents .= fread($fp, 1000000);
fclose($fp);
$pattern = "(\$[0-9 ]+\.[0-9]+)";
if (eregi($pattern, $contents, $quote))
{
echo $quote[1];
} else
{
echo 'No price available';
};
echo ''
." <a href=\"$theurl\"> more info</a> or <a href=\"$theurl\"> buy it now!</a><br /><br /><br />";
//<--end Paul's PHP Gamestop Scrape function-->//
MY PROBLEM: when the above scipt is executed, the incorrect data is displayed in my more.php pages....it returns $10.00 for everything...not sure why this is or if my script was even written correctly.
EXAMPLE OF PROBLEM: http://www.xboxstore.com/more.php?id=B00005NZ1G&cat=3&pcat=0 Scroll down the page till you get right above the ebay auctions. Look for the words "COMPARE PRICES on HALO Gamestop.com: $10.00 more info or buy it now!" in small white letters. Notice that if you click "buy it now" it takes you to the correct page on GameSpot but fails to scrape the correct pricing.
WHAT I AM TRYING TO DO: I would like my script to scrape the small image,the title of the product,the new or pre-owned price, and the corresponding buy link to purchase the product..for the first full page of product results. In this case, the first 9 matches for the XBOX game "Halo" desending from LOWEST PRICE to HIGHEST PRICE.
ANY HELP WOULD BE GREATLY APPRECIATED AS IT HAS COST ME MANY FRUSTRATING HOURS OF NON PRODUCTIVE WORK..TRYING TO FIGURE IT ALL OUT. THANK YOU AND GODBLESS, PAULIE FROM NEW YORK CITY (xboxstore.com) email: paul@xboxstore.com