<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>评论：利用Apache HTTPClient 4.x访问嘀咕API</title>
	<atom:link href="http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/</link>
	<description>一个关于生活感悟、新奇见闻、网站运营和电子商务的Blog</description>
	<lastBuildDate>Sun, 25 Jul 2010 01:30:11 +0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>来自：seashell</title>
		<link>http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/comment-page-1/#comment-1045</link>
		<dc:creator>seashell</dc:creator>
		<pubDate>Fri, 06 Nov 2009 14:33:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.williamhua.com/?p=153#comment-1045</guid>
		<description>您好，我看了您的博客受益匪浅。有一个问题就是用get方法进行身份验证的时候，设置一个请求拦截器，我对这个实在是不太了解，弄了好久都调试成功。不知道楼主能不能分享一下身份验证的代码呢？谢谢。</description>
		<content:encoded><![CDATA[<p>您好，我看了您的博客受益匪浅。有一个问题就是用get方法进行身份验证的时候，设置一个请求拦截器，我对这个实在是不太了解，弄了好久都调试成功。不知道楼主能不能分享一下身份验证的代码呢？谢谢。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：毛毛</title>
		<link>http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/comment-page-1/#comment-890</link>
		<dc:creator>毛毛</dc:creator>
		<pubDate>Wed, 29 Jul 2009 23:13:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.williamhua.com/?p=153#comment-890</guid>
		<description>我最近想搞个自动顶贴机，哈。
但是用到这个httpclient的post 方法，代码参照了apache例子的，我简直就是直接copy过去，
比如登陆163邮箱吧，form里写的方法是post·执行代码没有异常，不过显示操作结果的时候看到了用户名密码错误的提示，什么原因？
是不是密码的传送不能用basicNameValuePair这个类？

   DefaultHttpClient httpclient = new DefaultHttpClient(); 

      List nvps = new ArrayList();
       nvps.add(new BasicNameValuePair(&quot;userName&quot;, &quot;用户名&quot;));
       nvps.add(new BasicNameValuePair(&quot;password&quot;, &quot;密码&quot;));
        UrlEncodedFormEntity loginEntity = new UrlEncodedFormEntity(nvps, &quot;UTF-8&quot;);

        HttpPost httpost = new HttpPost(&quot;https://reg.163.com/logins.jsp&quot;);
        httpost.setEntity(loginEntity);

        response = httpclient.execute(httpost);
        entity = response.getEntity();

        System.out.println(&quot;Login form get: &quot; + response.getStatusLine());
        if (entity != null) {

            //  显示服务器反馈内容

            ResponseHandler responseHandler = new BasicResponseHandler();
            String responseBody = httpclient.execute(httpost, responseHandler);
            System.out.println(responseBody);
//
            entity.consumeContent();
	}</description>
		<content:encoded><![CDATA[<p>我最近想搞个自动顶贴机，哈。<br />
但是用到这个httpclient的post 方法，代码参照了apache例子的，我简直就是直接copy过去，<br />
比如登陆163邮箱吧，form里写的方法是post·执行代码没有异常，不过显示操作结果的时候看到了用户名密码错误的提示，什么原因？<br />
是不是密码的传送不能用basicNameValuePair这个类？</p>
<p>   DefaultHttpClient httpclient = new DefaultHttpClient(); </p>
<p>      List nvps = new ArrayList();<br />
       nvps.add(new BasicNameValuePair(&#8221;userName&#8221;, &#8220;用户名&#8221;));<br />
       nvps.add(new BasicNameValuePair(&#8221;password&#8221;, &#8220;密码&#8221;));<br />
        UrlEncodedFormEntity loginEntity = new UrlEncodedFormEntity(nvps, &#8220;UTF-8&#8243;);</p>
<p>        HttpPost httpost = new HttpPost(&#8221;https://reg.163.com/logins.jsp&#8221;);<br />
        httpost.setEntity(loginEntity);</p>
<p>        response = httpclient.execute(httpost);<br />
        entity = response.getEntity();</p>
<p>        System.out.println(&#8221;Login form get: &#8221; + response.getStatusLine());<br />
        if (entity != null) {</p>
<p>            //  显示服务器反馈内容</p>
<p>            ResponseHandler responseHandler = new BasicResponseHandler();<br />
            String responseBody = httpclient.execute(httpost, responseHandler);<br />
            System.out.println(responseBody);<br />
//<br />
            entity.consumeContent();<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：William Hua</title>
		<link>http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/comment-page-1/#comment-596</link>
		<dc:creator>William Hua</dc:creator>
		<pubDate>Mon, 01 Jun 2009 09:11:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.williamhua.com/?p=153#comment-596</guid>
		<description>&lt;a href=&quot;#comment-591&quot; rel=&quot;nofollow&quot;&gt;@xiaosena &lt;/a&gt; 
你好，
对于ClientProtocolException和MalformedChallengeException异常的问题，我后来参考了Preemptive BASIC authentication这个例子的代码，关键就是添加了一个addRequestInterceptor，代码可以看这里
http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java

HttpPost你遇到了什么问题？ 按照我上面贴的代码，最后调一个httpclient.execute(httppost); 应该就ok了

不好意思，现在代码不在身边，如果还有问题请留言。</description>
		<content:encoded><![CDATA[<p><a href="#comment-591" rel="nofollow">@xiaosena </a><br />
你好，<br />
对于ClientProtocolException和MalformedChallengeException异常的问题，我后来参考了Preemptive BASIC authentication这个例子的代码，关键就是添加了一个addRequestInterceptor，代码可以看这里<br />
<a href="http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java" rel="nofollow">http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java</a></p>
<p>HttpPost你遇到了什么问题？ 按照我上面贴的代码，最后调一个httpclient.execute(httppost); 应该就ok了</p>
<p>不好意思，现在代码不在身边，如果还有问题请留言。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：xiaosena</title>
		<link>http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/comment-page-1/#comment-591</link>
		<dc:creator>xiaosena</dc:creator>
		<pubDate>Mon, 01 Jun 2009 02:40:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.williamhua.com/?p=153#comment-591</guid>
		<description>您好，我现在正在研究这方面的东西，看到您的这篇博客，很受用。现在我遇到一个问题和您的一样，在使用HttpGet的时候会发出ClientProtocolException和MalformedChallengeException异常，不知道你最后是如何处理的。可不可以看一下你的源代码呢？
还有就是如果用HttpPost的时候该如何处理呢？
我的邮箱是：xiaosena@gmail.com
急切希望收到您的回复，谢谢。</description>
		<content:encoded><![CDATA[<p>您好，我现在正在研究这方面的东西，看到您的这篇博客，很受用。现在我遇到一个问题和您的一样，在使用HttpGet的时候会发出ClientProtocolException和MalformedChallengeException异常，不知道你最后是如何处理的。可不可以看一下你的源代码呢？<br />
还有就是如果用HttpPost的时候该如何处理呢？<br />
我的邮箱是：xiaosena@gmail.com<br />
急切希望收到您的回复，谢谢。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：William Hua</title>
		<link>http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/comment-page-1/#comment-588</link>
		<dc:creator>William Hua</dc:creator>
		<pubDate>Sun, 31 May 2009 14:08:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.williamhua.com/?p=153#comment-588</guid>
		<description>&lt;a href=&quot;#comment-578&quot; rel=&quot;nofollow&quot;&gt;@Estoremap &lt;/a&gt; 
WLW没有用过，不知道是不是支持发布时改permalink的功能，只要支持就ok</description>
		<content:encoded><![CDATA[<p><a href="#comment-578" rel="nofollow">@Estoremap </a><br />
WLW没有用过，不知道是不是支持发布时改permalink的功能，只要支持就ok</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：Chocolly</title>
		<link>http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/comment-page-1/#comment-587</link>
		<dc:creator>Chocolly</dc:creator>
		<pubDate>Sun, 31 May 2009 13:55:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.williamhua.com/?p=153#comment-587</guid>
		<description>嗯Webkit也是可以直接用Curl的认证功能,不用自己再搞个SSL模块</description>
		<content:encoded><![CDATA[<p>嗯Webkit也是可以直接用Curl的认证功能,不用自己再搞个SSL模块</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：Estoremap</title>
		<link>http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/comment-page-1/#comment-578</link>
		<dc:creator>Estoremap</dc:creator>
		<pubDate>Sun, 31 May 2009 06:45:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.williamhua.com/?p=153#comment-578</guid>
		<description>&lt;a href=&quot;#comment-538&quot; rel=&quot;nofollow&quot;&gt;@William Hua  &lt;/a&gt; 原来是这样子的，我主要是用WLW发的日志，所以没办法了，那就算了……</description>
		<content:encoded><![CDATA[<p><a href="#comment-538" rel="nofollow">@William Hua  </a> 原来是这样子的，我主要是用WLW发的日志，所以没办法了，那就算了……</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：William Hua</title>
		<link>http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/comment-page-1/#comment-546</link>
		<dc:creator>William Hua</dc:creator>
		<pubDate>Tue, 26 May 2009 09:55:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.williamhua.com/?p=153#comment-546</guid>
		<description>&lt;a href=&quot;#comment-545&quot; rel=&quot;nofollow&quot;&gt;@febird &lt;/a&gt; 
哈哈，那个是wireshark的截图</description>
		<content:encoded><![CDATA[<p><a href="#comment-545" rel="nofollow">@febird </a><br />
哈哈，那个是wireshark的截图</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：febird</title>
		<link>http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/comment-page-1/#comment-545</link>
		<dc:creator>febird</dc:creator>
		<pubDate>Tue, 26 May 2009 08:18:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.williamhua.com/?p=153#comment-545</guid>
		<description>你那个example的图片我还以为是 wordpress代码折叠插件所为，点了半天不见展开。</description>
		<content:encoded><![CDATA[<p>你那个example的图片我还以为是 wordpress代码折叠插件所为，点了半天不见展开。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：William Hua</title>
		<link>http://www.williamhua.com/2009/05/23/acccess-digu-api-through-apache-httpclient-4/comment-page-1/#comment-539</link>
		<dc:creator>William Hua</dc:creator>
		<pubDate>Tue, 26 May 2009 05:28:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.williamhua.com/?p=153#comment-539</guid>
		<description>&lt;a href=&quot;#comment-536&quot; rel=&quot;nofollow&quot;&gt;@短歌行 &lt;/a&gt; 
是在你自己的NAS上吗？
基本上你看看这个post就明白了 http://home.mysql.cn/space-55789-do-blog-id-79.html</description>
		<content:encoded><![CDATA[<p><a href="#comment-536" rel="nofollow">@短歌行 </a><br />
是在你自己的NAS上吗？<br />
基本上你看看这个post就明白了 <a href="http://home.mysql.cn/space-55789-do-blog-id-79.html" rel="nofollow">http://home.mysql.cn/space-55789-do-blog-id-79.html</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
