我有一个使用 Yahoo Geocoding Placefinder API 的网络应用程序,直到今天早些时候它都运行良好。它只是随机停止工作。他们不再支持了吗?我在网上找遍了,找不到任何关于他们放弃支持的信息,但我的代码不再有效。这是我的代码...
function geocode_yahoo($address,$city,$state,$country) {
$address = array($address, $city, $state, $country);
$address = array_filter($address);
$address = urlencode(implode(', ', $address));
$appid = 'CYxSRa64';
$url = 'http://where.yahooapis.com/geocode?location='.$address.'&flags=J&appid='.$appid;
$data = file_get_contents($url);
if ($data != '') {
$data = json_decode($data);
if ($data && $data->ResultSet && $data->ResultSet->Error == '0' && $data->ResultSet->Found) {
return (object) array('lat'=>$data->ResultSet->Results[0]->latitude, 'lng'=>$data->ResultSet->Results[0]->longitude);
}
}
return false;
}
最佳答案
您的代码没有问题,服务只是停止了。
请注意 http://where.yahooapis.com现在返回 404 页面。
该服务原定于 2012 年 11 月下旬停用,但仍在运行,以便为开发人员提供时间迁移到替代的 Yahoo BOSS 服务:http://developer.yahoo.com/boss/geo/
关于php - Yahoo Placefinder Geocoding 随机停止工作......他们现在不支持了吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15777371/