problem with geonames_query('countrycode', ...

HI,

I've some problems with geonames_query('countrycode', ..).
This function return always null.

Here our php code :

$query = array($form_values['latitude'], $form_values['longitude']);
$result = geonames_query('countrycode', $query);
if($result==NULL){
$pays='ko';
}

Could someone help us to fix this pb?
Thank You

Babel.

$lat =

$lat = $locat[latitude];
$long = $locat[longitude];

$query = array(
'lat' => $lat,
'lng' => $long
);

$result = geonames_query('countrycode', $query);
if($result){
print_r($result);
}
i tried this code but it still returns nothing but when i print $result, it shows me
stdClass Object ( [standalone] => no [total_results_count] => 0 [service] => countrycode [request] => Array ( [url] => http://ws.geonames.net/countrycode?username=&lat=31.5450500&lng=74.34068... [bytes] => 255 [cached] => data [seconds] => 0.00301885604858 ) [query] => Array ( [lat] => 31.5450500 [lng] => 74.3406830 [type] => xml ) )
where"[total_results_count] => 0" is zero.......
can anyone help me?

serosero's picture

The query parameter should

The query parameter should be an associative array, try the following:

$query = array(
'lat' => $form_values['latitude'],
'lng' => $form_values['longitude']
);

Syndicate content