Visa ett inlägg
Oläst 2008-04-25, 09:21 #1
JLEs avatar
JLE JLE är inte uppkopplad
Flitig postare
 
Reg.datum: Jul 2007
Inlägg: 382
JLE JLE är inte uppkopplad
Flitig postare
JLEs avatar
 
Reg.datum: Jul 2007
Inlägg: 382
Google släppte igår ett nytt REST API som skall ersätta deras SOAP API (som de slutade att dela ut API nyckar till 2006):

Mycket trevlig nyhet för de som som vill göra sökfrågor "server-side".

Dokumentation: http://code.google.com/apis/ajaxsearch/doc...entation/#fonje
Video: http://google-code-updates.blogspot.com/20...om-outside.html

För att använda Googles REST API i PHP:

Kod:
$url = “http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Hello%20World”

// sendRequest
// note how referer is set manually
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, “http://www.knark.com”);
$body = curl_exec($ch);
curl_close($ch);

// now, process the JSON string
$json = json_decode($body);
// now have some fun with the results…
JLE är inte uppkopplad   Svara med citatSvara med citat