我在iPhone应用程序中使用Google Weather API,最近有时它会返回403错误,但现在它返回了一个非常时髦的错误,说"无法使用API",无论我进入它的位置.这里的例子.
有人知道发生了什么吗?我检查了Google天气监控链接,它说一切正常.到底他妈发生了什么?吴
我正在尝试加载解析Google Weather API响应(中文回复).
这是API调用.
// This code fails with the following error
$xml = simplexml_load_file('http://www.google.com/ig/api?weather=11791&hl=zh-CN');
Run Code Online (Sandbox Code Playgroud)
(!)警告:simplexml_load_string()[function.simplexml-load-string]:实体:第1行:解析器错误:输入不正确UTF-8,表示编码!字节:第11行的C:\ htdocs\weather.php中的0xB6 0xE0 0xD4 0xC6
为什么加载此响应失败?
如何对响应进行编码/解码以便simplexml正确加载?
编辑:这是代码和输出.
<?php
$googleData = file_get_contents('http://www.google.com/ig/api?weather=11102&hl=zh-CN');
$xml = simplexml_load_string($googleData);
Run Code Online (Sandbox Code Playgroud)
(!)警告:simplexml_load_string()[function.simplexml-load-string]:实体:第1行:解析器错误:输入不正确UTF-8,表示编码!字节:0xB6 0xE0 0xD4 0xC6在C:\ htdocs\test4.php第3行调用堆栈时间内存函数位置1 0.0020 314264 {main}()..\test4.php:0 2 0.1535 317520 simplexml_load_string(string(1364)) ..\test4.php:3
(!)警告:simplexml_load_string()[function.simplexml-load-string]:t_system data ="SI"/>
(!)警告:simplexml_load_string()[function.simplexml-load-string]:^在第3行的C:\ htdocs\test4.php中调用堆栈时间内存函数位置1 0.0020 314264 {main}()..\test4. php:0 2 0.1535 317520 simplexml_load_string(string(1364))..\test4.php:3
我需要根据用户的当前位置获取天气信息。请向我提供 Google API 以获取天气信息。
我正在使用http://www.google.com/ig/api?weather=Mumbai,但 Google 返回了一些错误:
我们很抱歉...
...但您的计算机或网络可能正在发送自动查询。为了保护我们的用户,我们现在无法处理您的请求。
有关详细信息,请参阅 Google 帮助。
当我在 Google 上查找时,我发现 Google API 已关闭。
请指导我哪一个是最新的谷歌 API 来获取天气信息。
我准备了一个简化的测试用例和截图.
我想我错过了一点点,只需几行代码.
我在JavaScript Google地图中有2个叠加层(天气和云),并且想要在点击相应的复选框时隐藏或显示它们:

这是测试用例,只需将其粘贴到.html文件中即可运行:
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
h1,p {
text-align: center;
}
#map {
width: 700px;
height: 400px;
margin-left: auto;
margin-right: auto;
background-color: #CCCCFF;
}
</style>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false&language=de&libraries=weather"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
findCity('Berlin');
$('#weather_box,#clouds_box').click(function(){
alert('How to hide/show layers? Checked: ' + $(this).is(':checked'));
});
});
function createMap(center) {
var opts = {
zoom: 6,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
return new google.maps.Map(document.getElementById('map'), opts);
}
function findCity(city) {
var gc = new …Run Code Online (Sandbox Code Playgroud) google-maps weather weather-api google-maps-api-3 google-weather-api
我是否可以在商业项目中使用Google Weather API,如果我刚添加了"由Google支持的天气"链接?
我想使用Google Weather API - 通过传递lat和long值.我存储这些值,但似乎Google需要不同格式的这些值.
即对于McTavish镇,我有45.5和-73.583的价值
这可以在这里工作:http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=45.5,-73.583
但是当我将这些数据用于Google API时,它不起作用:请参阅:www.google.com/ig/api?weather =,,455.5,-73.583
任何帮助赞赏.我更愿意使用Google数据.
我使用Google Weather API创建了一个插件,目前我正在从Google的API中提取图片.阳光灿烂的日子,我在拉http://www.google.com//ig/images/weather/sunny.gif.
我正在寻找一种方法,以便在拉出sunny.gif时,用我选择的图像替换.
这可能与jQuery或其他方式?
非常感谢
谷歌天气API显示华氏温度.
看完这篇文章后,我能够将温度从F转换为C.
但是,它表现得像17.222222222222° C - 28.888888888889° C, Clear.我怎么才能做到这一点17° C-28° C.
提前致谢.
我使用"http://maps.googleapis.com/maps/api/geocode/xml?address="+address+"&sensor=true"来获取某个位置的纬度和经度.从这个我得到如下响应:
<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
<status>OK</status>
<result>
<type>locality</type>
<type>political</type>
<formatted_address>Chicago, IL, USA</formatted_address>
<address_component>
<long_name>Chicago</long_name>
<short_name>Chicago</short_name>
<type>locality</type>
<type>political</type>
</address_component>
<address_component>
<long_name>Cook</long_name>
<short_name>Cook</short_name>
<type>administrative_area_level_2</type>
<type>political</type>
</address_component>
<address_component>
<long_name>Illinois</long_name>
<short_name>IL</short_name>
<type>administrative_area_level_1</type>
<type>political</type>
</address_component>
<address_component>
<long_name>United States</long_name>
<short_name>US</short_name>
<type>country</type>
<type>political</type>
</address_component>
<geometry>
<location>
<lat>41.8781136</lat>
<lng>-87.6297982</lng>
</location>
<location_type>APPROXIMATE</location_type>
<viewport>
<southwest>
<lat>41.7450495</lat>
<lng>-87.8859170</lng>
</southwest>
<northeast>
<lat>42.0109012</lat>
<lng>-87.3736794</lng>
</northeast>
</viewport>
<bounds>
<southwest>
<lat>41.6443350</lat>
<lng>-87.9402669</lng>
</southwest>
<northeast>
<lat>42.0231310</lat>
<lng>-87.5236609</lng>
</northeast>
</bounds>
</geometry>
</result>
</GeocodeResponse>
Run Code Online (Sandbox Code Playgroud)
响应具有许多位置的lng和lat值.那么我要考虑哪一个?
google-maps latitude-longitude weather-api google-maps-api-3 google-weather-api
我有一个用于Google天气API的XML输出代码,我想知道如何将其输出到HTML中.我知道必须涉及一些PHP,但我在PHP方面非常有限.
这是代码:
<forecast_information>
<city data="Toronto, ON"/>
<postal_code data="Toronto"/>
<latitude_e6 data=""/>
<longitude_e6 data=""/>
<forecast_date data="2011-03-11"/>
<current_date_time data="2011-03-11 15:07:00 +0000"/>
<unit_system data="US"/>
</forecast_information>
<current_conditions>
<condition data="Rain and Snow"/>
<temp_f data="36"/>
<temp_c data="2"/>
<humidity data="Humidity: 100%"/>
<icon data="/ig/images/weather/rain_snow.gif"/>
<wind_condition data="Wind: S at 6 mph"/>
</current_conditions>
<forecast_conditions>
<day_of_week data="Fri"/>
<low data="31"/>
<high data="37"/>
<icon data="/ig/images/weather/rain_snow.gif"/>
<condition data="Rain and Snow"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="Sat"/>
<low data="28"/><high data="38"/>
<icon data="/ig/images/weather/rain_snow.gif"/>
<condition data="Rain and Snow"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="Sun"/>
<low data="18"/>
<high data="32"/>
<icon data="/ig/images/weather/snow.gif"/>
<condition data="Snow …Run Code Online (Sandbox Code Playgroud) weather-api ×5
php ×3
weather ×3
api ×2
google-maps ×2
xml ×2
google-api ×1
ios ×1
iphone ×1
javascript ×1
jquery ×1
simplexml ×1
xhtml ×1
xslt ×1