阅读背景:

从具有多个值的JSON响应中查找最低JSON值

来源:互联网 

I have this code:

我有这个代码:

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));
        echo "<a href=\"{$obj->items[0]->product->link}\">{$name}</a> ${$obj->items[0]->product->inventories[0]->price}<br/>";
    }
}
foreach($specs as



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: