I'm going to use the google ajax api serch in a server side
application from php.
I understand that google request to send http referer and (optionaly)
API key.

I have the API key already.

How to use it, when, where?

I mean, I have seen the code for php (below)
Then if I need to make several queries from one single page:
Do I need to use all these for every query? Or just the first time for
each page?

And what about the key, where does it go?

$url = "http://ajax.googleapis.com/ajax/services/search/web?
v=1.0&q=Paris%20Hilton"

// 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.mysite.com/index.html";);
$body = curl_exec($ch);
curl_close($ch);

// now, process the JSON string
$json = json_decode($body);
// now have some fun with the results...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to