私はGoogleの検索APIをクエリするためにlaravelを使用しています。これを行うコードは次のとおりです。
Route::get('google/(:any)', function($query)
{
$uri = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=".$query;
$response = Httpful::get($uri)->send();
$r = json_decode($response);
return Response::json($r);
});
これはhttp://example.com/w/google/queryhereからアクセスできます
また、JavaScriptで複数のリクエストを作成し、jsonを解析しようとしています。
$.when( $.ajax(google), $.ajax(bing), $.ajax(yahoo)).then(function(resp1, resp2, resp3)
{
var obj = jQuery.parseJSON(resp1);
});
ただし、parseJSONメソッドを使用すると、予期しない構文トークンが取得されます。どこが間違っていたのかわかりません。