Tôi đang sử dụng sau php code để lấy múi giờ:Echo thông báo trạng thái trong geonames php múi giờ
$url = 'http://api.geonames.org/timezone?lat=' . $latitude . '&lng=' . $longitude . '&username=demo';
$xml = simplexml_load_file($url);
foreach($xml->children() as $timezone)
{
echo "TimezoneId: ".$timezone->timezoneId." ";
echo "DstOffset : ".$timezone->dstOffset." ";
echo "GmtOffset : ".$timezone->gmtOffset." ";
}
nó hoạt động nhưng đối với vĩ độ và kinh độ của Antartica ví dụ nó cho lỗi thông báo trạng thái:
<status message="no timezone information found for lat/lng" value="15"/>
Cách lặp lại thông báo này?
Tôi tryng này:
if ($xml->status) {
echo "error: ".$timezone->status['message']. "";
}
nhưng không có tác dụng