Code_HttpClient

HttpClient is NOT a browser. It is a client side HTTP transport library. HttpClient's purpose is to transmit and receive HTTP messages. HttpClient will not attempt to cache content, execute javascript embedded in HTML pages, try to guess content type, or reformat request / redirect location URIs, or other functionality unrelated to the HTTP transport.
     摘要: 通常許多web資源是面向登錄用戶的,如果我們想利用程序自動獲取,則必須要通過程序登錄之後才能實現。java本身提供的標準庫也可以實現客戶端的登錄,但是卻不能自動管理服務器返回的cookie,必須手動管理。這個是十分麻煩和繁瑣的。幸好有APACHE 的 HTTPCLIENT,我們不必在擔心如何管理cookie。所以用hc登錄,獲取資源都是十分簡單和方便的。在這裡用一段源碼記錄如何使用hc等錄一個website,以及如何通過代理登錄和通過代理訪問頁面。  阅读全文

posted @ 2010-07-29 10:54 祝嘉 阅读(429) | 评论 (0)  编辑 |

     摘要: 使用Apache的HTTPCLIENT獲取網頁的內容  阅读全文

posted @ 2010-07-28 20:27 祝嘉 阅读(311) | 评论 (0)  编辑 |