Sto cercando di restituire il contenuto da maps.google.com da Delphi 2006 utilizzando il componente TIdHTTP.Come posso recuperare le mappe statiche di Google con TIdHTTP?
Il mio codice è il seguente
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.' +
'&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;
Tuttavia continuo a ricevere la risposta HTTP/1.0 403 Forbidden. Presumo questo significa che non ho il permesso di fare questa richiesta ma se copio l'url nel mio browser IE 8, funziona bene. C'è qualche informazione di intestazione di cui ho bisogno o qualcos'altro?