我正在尝试连接我的 Google 帐户并获取我的博客主页的 html 代码。我发现需要一个 cookie 来保持连接,但我不知道该怎么做。
用户名和密码的邮寄地址是“https://www.google.com/accounts/ClientLogin”
提前致谢!
我正在尝试连接我的 Google 帐户并获取我的博客主页的 html 代码。我发现需要一个 cookie 来保持连接,但我不知道该怎么做。
用户名和密码的邮寄地址是“https://www.google.com/accounts/ClientLogin”
提前致谢!
尝试这个
private bool Authorize(out string authCode)
{
bool result = false;
authCode = "";
string queryString = String.Format("https://www.google.com/accounts/ClientLogin?accountType=HOSTED_OR_GOOGLE&Email={0}&Passwd={1}&service=cloudprint&source={2}", UserName, Password, Source);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(queryString);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string responseContent = new StreamReader(response.GetResponseStream()).ReadToEnd();
string[] split = responseContent.Split('\n');
foreach (string s in split)
{
string[] nvsplit = s.Split('=');
if (nvsplit.Length == 2)
{
if (nvsplit[0] == "Auth")
{
authCode = nvsplit[1];
result = true;
}
}
}
return result;
}
`
Google Code Playground有一些很好的例子来说明如何做事。 下面是一个如何从博客中检索帖子的示例。希望能帮助到你。