Advertisement
Guest User

Untitled

a guest
Jul 25th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. foreach($specs as $spec) {
  2.     if(preg_match('/^(\w+):\s*(.*?)\s\$?(\d*\.?\d*)$/', $spec, $matches)) {
  3.         list(,$tag,$name,$price) = $matches;
  4.        
  5.         $url = 'https://www.googleapis.com/shopping/search/v1/public/products?country=AU&key=KEY&q=' . urlencode($name);
  6.         $obj = json_decode(file_get_contents($url));
  7.         usort($obj->items, function ($a) {      
  8.  
  9.         echo "<a href=\"{$obj->items[0]->product->link}\">{$name}</a> \${$a->product->inventories[0]->price[1]}<br/>";
  10.         });
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement