当前注册人数422581人 邮箱: 密码: 注册新用户 忘记密码
首页 C/C++/MFC C# ASP.NET VB.NET MATLAB Android   站内搜索 下载代码说明/积分规则
为什么要注册?

1. 可以直接免费从本站下载代码,防止邮件发送不到您的邮箱,或登录不了国外网站

2. 可以设定关键字,当有您关心的代码收录时,邮件通知您

3. 对这里的代码进行评分和评论

4. 可以和大家一起分享你的源代码,得到更多的建议

A C# Google Bookmarks Class

C#实现GOOGLE的书签API类

2008年03月04日
C#, C# 2.0, Windows, .NET, .NET 2.0, VS, WinForms, VS2005, Dev
这里的程序,实现了对GOOGLE的书签服务器进行封装;现有的版本支持读出所有指定账户下的书签。在未来版本中将支持对帐号下书签进行添加和修改操作。
相关知识
private bool GB_Login(string username, string password)
{
    string url = "https://www.google.com/accounts/ServiceLoginAuth";

    HttpWebRequest req;

    req = (HttpWebRequest)HttpWebRequest.Create(url);

    req.AllowAutoRedirect = true;
    req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
    req.CookieContainer = CookieCont;
    req.Accept = "*";
    req.Method = "POST";
    req.ContentType = "application/x-www-form-urlencoded";

    StringBuilder postData = new StringBuilder();
    postData.AppendFormat("{0}={1}&", "service", "bookmarks");
    postData.AppendFormat("{0}={1}&", "nui", "1");
    postData.AppendFormat("{0}={1}&", "hl", "en");
    postData.AppendFormat("{0}={1}&", "Email", username);
    postData.AppendFormat("{0}={1}&", "Passwd", password);
    postData.AppendFormat("{0}={1}&", "PersistentCookie", "yes");
    postData.AppendFormat("{0}={1}&", "rmShown", "1");
    postData.AppendFormat("{0}={1}&", "continue", 
    "http://www.google.com/bookmarks/lookup%3Foutput%3Dxml%26num%3D10000");

    byte[] postDataBytes = Encoding.UTF8.GetBytes(postData.ToString());

    req.ContentLength = postDataBytes.Length;

    Stream postDataStream = req.GetRequestStream();
    postDataStream.Write(postDataBytes, 0, postDataBytes.Length);
    postDataStream.Close();

    HttpWebResponse resp;

    resp = (HttpWebResponse)req.GetResponse();

    Stream rcvStream = resp.GetResponseStream();
    byte[] respBytes = new byte[8192];
    int byteCount;
    StringBuilder wText = new StringBuilder();

    do
    {
        byteCount = rcvStream.Read(respBytes, 0, 8192);
        wText.Append(Encoding.ASCII.GetString(respBytes));
    } 
    while (byteCount > 0);

    resp.Close();
    rcvStream.Close();

    return true;
}
源代码原文下载:
A C# Google Bookmarks Class An article on how to implement Google Bookmarks in your application

源码图片

点击链接查看大图
从本站下载附件及源代码(1个附件,已经成功下载129次)

最值得关注的外文源代码

Clog - Client Logging, WPF Edition
Google X script
Request Google´s Pagerank programmatically
Clustering Toolbox: four categories of functions
评论(评论是增加积分的一个有效途径)
字数在300字内
请如实评论
本源代码共评论23次,此处显示最近11次评论! 查看所有评论

reixuemin  2013年02月20日
不错,谢谢分享哦
xiaosonl  2010年05月02日
不能用
cat  2009年08月05日
值得学习
kevinju  2009年07月01日
good
盖茨  2008年11月10日
C#实现GOOGLE的书签API类
winnxm  2008年11月10日
good
itcabb  2008年09月03日
r
lry  2008年08月20日
C#实现GOOGLE的书签API类
xianshuang  2008年06月20日
学习
xianshuang  2008年06月20日
学习
witchsnk  2008年06月20日
谢谢。研究下
字数在300字内
请如实评论
200万国内源码搜索
CopyRight (C) codesoso.com 2007-2009 All Rights Reserved zhihuishi   免责声明