Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach($specs as $spec) {
- if(preg_match('/^(\w+):\s*(.*?)\s\$?(\d*\.?\d*)$/', $spec, $matches)) {
- list(,$tag,$name,$price) = $matches;
- $url = 'https://www.googleapis.com/shopping/search/v1/public/products?country=AU&key=KEY&q=' . urlencode($name);
- $obj = json_decode(file_get_contents($url));
- usort($obj->items, function ($a) {
- echo "<a href=\"{$obj->items[0]->product->link}\">{$name}</a> \${$a->product->inventories[0]->price[1]}<br/>";
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement