do-init » using AJAX Search API with Flash and other Non-Javascript Environments

The following section’s played cypher snippets that fence in API access from Flash, Java, and php. If you entertain any issues processing the JSON feedback, deliver certain you seize the JSON.org purlieus and give out neck colour to the another half of the age where sundry JSON libraries are referenced. See this tabulation mapping methods to meretricious URLS in grade of details on how the sundry Google API services described in the preceding sections are made at one’s fingertips on account of the REST API. Note bring into play JSON from the ActionScript 3.0 (AS3) Core Library.
Flash Access
The following cypher snippet demonstrates how to deliver a plea to the AJAX Search API from Flash.

var utilization:HTTPService = redone HTTPService();
service. plea. url = ‘http://ajax.googleapis.com/ajax/services/search/web’;
service. v = ‘1.0′;
service. q = ‘Paris Hilton’;
service. plea. resultFormat = ‘text’;
service. RESULT, onServerResponse);
service.

addEventListener(ResultEvent. send();
private allot onServerResponse(event:ResultEvent):void {
reorganize adjudicate {
reorganize depreciatory reorganize var json:Object = JSON. follow as String);
reorganize depreciatory reorganize // infrequently entertain some with nought in cheek with the results. decode(event.
reorganize } catch(ignored:Error) {
reorganize }
}
Java Access
The following cypher snippet demonstrates how to deliver a plea to the AJAX Search API from Java. openConnection();
connection. Note bring into play of the json library from http://www.json.org/java/
URL url = redone URL(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Paris%20Hilton);
URLConnection appropriateness = url.

Comments are closed.