2

https://maps.google.com/locationhistory/b/0から kml ファイルをダウンロードする ac# コードを記述しようとしています。

私は次のコードを書きましたが、返された http 応答はログイン ページに移動します。

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://maps.google.com/locationhistory/b/0/kml?startTime=1373666400000&endTime=1373752800000");

        request.Credentials = new NetworkCredential("username", "password");
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        // Get the stream associated with the response.
        Stream receiveStream = response.GetResponseStream();

        // Pipes the stream to a higher level stream reader with the required encoding format. 
        StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);

        using (StreamWriter outfile = new StreamWriter(@"temp.kml"))
        {
            outfile.Write(readStream.ReadToEnd());
        }

        response.Close();
        readStream.Close();

ユーザー資格情報を渡そうとします。私はすでにこれらのソリューションを試しました: -基本認証に HttpWebRequest.Credentials プロパティを使用するには? -基本認証を使用する C# HttpWebRequest が機能しませんでした。

Google資格情報を渡す方法を知っていて、Googleロケーション履歴APIを経験した人はいますか?

ありがとう!

4

0 に答える 0