$result = $client->get('http://ws.geonames.org/search?'.$str);
- if ($result->code == "200") {
- $rj = json_decode($result->body);
+ if ($result->isOk()) {
+ $rj = json_decode($result->getBody());
if (count($rj->geonames) > 0) {
$n = $rj->geonames[0];
$location->location_id = $n->geonameId;
$location->location_ns = self::NAMESPACE;
- // handled, don't continue processing!
+ // handled, do not continue processing!
return false;
}
}
- // Continue processing; we don't have the answer
+ // Continue processing; we do not have the answer
return true;
}
$result = $client->get('http://ws.geonames.org/hierarchyJSON?'.$str);
- if ($result->code == "200") {
+ if ($result->isOk()) {
- $rj = json_decode($result->body);
+ $rj = json_decode($result->getBody());
if (count($rj->geonames) > 0) {
$result =
$client->get('http://ws.geonames.org/findNearbyPlaceNameJSON?'.$str);
- if ($result->code == "200") {
+ if ($result->isOk()) {
- $rj = json_decode($result->body);
+ $rj = json_decode($result->getBody());
if (count($rj->geonames) > 0) {
}
}
- // For some reason we don't know, so pass.
+ // For some reason we do not know, so pass.
return true;
}
$result = $client->get('http://ws.geonames.org/hierarchyJSON?'.$str);
- if ($result->code == "200") {
+ if ($result->isOk()) {
- $rj = json_decode($result->body);
+ $rj = json_decode($result->getBody());
if (count($rj->geonames) > 0) {
$url = 'http://www.geonames.org/' . $location->location_id;
- // it's been filled, so don't process further.
+ // it's been filled, so do not process further.
return false;
}
}