200) {
return true;
}
return false;
}
/**
* Return current API URL
*/
function api_get_url() {
return "http://api.wbext.com/v2";
}
?>
Example using World Bank API
children('http://www.worldbank.org');
?>
0 && !empty($_REQUEST['country'])) { // if the user submitted the form
// Set url to make photos query into the API, based on the country the user selected
$url = api_get_url()."/photos?country=".$_REQUEST['country']."&api_key=".$apiKey;
?>
Query url:
children('http://www.worldbank.org');
if((integer) $xml['total'] == 0) {
echo "No photos found for " . $_REQUEST['country'] . ".";
}
else {
// loop through photos returned
foreach($photos as $photo) {
echo ""; // link to the higher resolution image
echo "
"; // print the image to the screen
echo "";
}
}
}
?>