Tools

[insert_php]
echo nl2br(“Generate API call.\n”);
//Country
$countrySource = file_get_contents(‘http://data.un.org/ws/rest/codelist/unsd/CL_REF_AREA_SDG/’);
$countryXml = simplexml_load_string($countrySource);
$countryData = $countryXml->Structures->Codelists->Codelist->Code;
//Indicators
$indicatorSource = file_get_contents(‘http://data.un.org/ws/rest/codelist/unsd/CL_SERIES_SDG/’);
$indicatorXml = simplexml_load_string($indicatorSource);
$indicatorData = $indicatorXml->Structures->Codelists->Codelist->Code;
echo ‘

‘;
echo nl2br(“Select a country:\n”);
echo ‘







‘;
echo nl2br(“\nSelect an indicator:”);
echo ‘







‘;
echo nl2br(“\n”);
echo ‘‘;
echo ‘

‘;
if (isset($_GET[‘search’])) {
$url = ‘http://data.un.org/ws/rest/data/DF_UNDATA_SDG/.’ . $_GET[‘series’] . ‘…..’ . $_GET[‘country’] . ‘../’;
echo ‘‘ . $url . ‘‘;
}
[/insert_php]