array readAPI(string API ID, string request, [string API Key])
APIs (standardized interfaces, Application Programming Interface) allow third-party services to be incorporated into the developer's own software or questionnaire. The function readAPI()
accesses these services directly within the questionnaire.
The function translates the answer of the API directly into an array, which can be set up relatively easily in PHP. Use the function debug()
to display the content of the answer.
// request to Google Maps (search for a street using coordinates) $v = readAPI('google.maps.v3','latlng=40.714224,-73.961452&sensor=false'); debug($v); // output of street found html('<p>Straße: '.$v['results'][0]['address_components'][1]['long_name'].'</p>');
// request to Cloudmade $v = readAPI('cloudmade.geocoding.v2','around=52.4870,13.4248&distance=closest&object_type=address&return_location=true','API-KEY'); debug($v);