clo*_*if3 6 delphi google-maps
我正在尝试使用TIdHTTP组件从Delphi 2006中返回maps.google.com中的内容.
我的代码如下
procedure TForm1.GetGoogleMap();
var
t_GetRequest: String;
t_Source: TStringList;
t_Stream: TMemoryStream;
begin
t_Source := TStringList.Create;
try
t_Stream := TMemoryStream.Create;
try
t_GetRequest :=
'http://maps.google.com/maps/api/staticmap?' +
'center=Brooklyn+Bridge,New+York,NY' +
'&zoom=14' +
'&size=512x512' +
'&maptype=roadmap' +
'&markers=color:blue|label:S|40.702147,-74.015794' +
'&markers=color:green|label:G|40.711614,-74.012318' +
'&markers=color:red|color:red|label:C|40.718217,-73.998284' +
'&sensor=false';
IdHTTP1.Post(t_GetRequest, t_Source, t_Stream);
t_Stream.SaveToFile('google.html');
finally
t_Stream.Free;
end;
finally
t_Source.Free;
end;
end;
Run Code Online (Sandbox Code Playgroud)
但是我一直得到HTTP/1.0 403 Forbidden的响应.我认为这意味着我没有权限提出此请求但是如果我将网址复制到我的网络浏览器IE 8中,它可以正常工作.是否有我需要的标题信息或其他内容?
您是否拥有需要身份验证的代理服务器?
我不再安装 Delphi,但我认为 Indy 组件支持代理身份验证,例如......(未经测试)
IdHTTP1.ProxyParams.ProxyServer := 'http://proxyaddress';
idHTTP1.ProxyParams.ProxyPort := 8080;
idHTTP.ProxyParams.ProxyUserName := 'name';
idHTTP.ProxyParams.ProxyPassword := 'pwd';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2216 次 |
| 最近记录: |