Question

Je suis en train de se connecter à Google API les données cartographiques (se MyMaps) avec wininet et delphi, mais toujours une réponse Recevied:. Jeton non valide

Je l'ai obtenu auth Toke avec wininet appel HTTPS.
Quel est le problème ?

S'il vous plaît help.Here un exemple de code:



ServerURL='maps.google.com';
pathURL='/maps/feeds/maps/default/full';
headers='Authorization: GoogleLogin auth="jbhi6....7it6g976"'; //or like that

function SendHTTP_GET(const ServerURL, pathURL, headers:string): string;
var
  IInternet, Connection, aFile: HINTERNET;
begin
  Result:= '';
  IInternet := InternetOpen(PChar('MyApp'), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
  try
    Connection := InternetConnect(IInternet, pAnsiChar(ServerURL), INTERNET_DEFAULT_HTTP_PORT, nil, nil, INTERNET_SERVICE_HTTP, 0, 0);
    try
      aFile := HttpOpenRequest(Connection,'GET',pAnsiChar(pathURL), nil, nil, nil, 0, 0);
      try
        if HttpSendRequest(aFile, pAnsiChar(headers), Length(headers), nil, 0) then
          Result := ReadStreamData(aFile)
      finally
        InternetCloseHandle(aFile);
      end;
    finally
      InternetCloseHandle(Connection);
    end;
  finally
    InternetCloseHandle(IInternet);
  end;
end;

Était-ce utile?

La solution

Terminate les en-têtes avec un saut de ligne peut-être?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top