Working with the Google Location API

前端 未结 6 2094
别跟我提以往
别跟我提以往 2021-02-06 05:50

Forgive me for my ignorance, but after several hours of searching, I\'m having little luck.

Anyway, I am attempting to write a small desktop application that will allow

6条回答
  •  情书的邮戳
    2021-02-06 06:31

    If your doing this in C#, you will want to use the HttpWebRequest and HttpWebResponse classes. You can pass the parameterized URL (google API call)as an argument to the Create() method. I would suggest requesting the data be returned as XML data. After you close the connection (httpWResp.Close()), you can read using a stream reader. See documentation on the GetResponseStream() method: http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.getresponsestream.aspx

    HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create("http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address=1+Maritime+Plaza+San+Francisco+CA ");

    HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse(); // Insert code that uses the response object. HttpWResp.Close();

提交回复
热议问题