项目 >> 网络组件 >> Httpclient

Httpclient

Httpclient The Hyper-Text Transfer Protocol (HTTP) is perhaps the most significant protocol used on the Internet today. Web services, network-enabled appliances and the growth of network computing continue to expand the role of the HTTP protocol beyond user-driven web browsers, while increasing the number of applications that require HTTP support.

Homepage: http://commons.apache.org/httpclient/

Loading...

使用httpclient下载需要登录的网页

import java.io.IOException; import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.cookie.*; import org.apache.commons.httpclient.methods.*; public class JClientLoginTest { public static void main(String[] args) throws HttpException, IOException {   HttpClient client = new HttpClient();  ...

HttpClient的使用

下载页面文件 import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.methods.*; public class GetPageExample {  public static void main( String[] args ) {    if( args.length() == 0 ) {     System.out.println( "Usage: java GetPageExample URL" );     Sys...

HttpClient和HtmlParser配合实现自动登陆系统抽取页面信息

HtmlParser代码接口变化比较多,因此写一个最新的。废话不多说,贴代码共大家享用! /*  * Main.java  *  * Created on 2007年1月19日, 上午9:14  *  * To change this template, choose Tools | Template Manager  * and open the template in the editor.  */ package wapproxy; import org.apache.commons.ht...

用HttpClient来模拟浏览器GET POST

一般的情况下我们都是使用IE或者Navigator浏览器来访问一个WEB服务器,用来浏览页面查看信息或者提交一些数据等等。所访问的这些页面有的仅仅是一些普通的页面,有的需要用户登录后方可使用,或者需要认证以及是一些通过加密方式传输,例如HTTPS。目前我们使用的浏览器处理这些情况都不会构成问题。不过你可能在某些时候需要通过程序来访问这样的一些页面,比如...

httpclient 3.0初步研究

最近一直试图用httpClient做点自动化的工作,不过现在看来并没有想象中的那么轻松。 实际上登录一个网站,访问某个特点的页面,发表一篇文章,上传一些文件,并不是一个简单的事情。 HttpClient的基本使用因为发布的代码中带有几个例子,应该算是不难掌握的事情。下面我说下我遇到的几个问题。 1,登陆验证图片问题 首先登录的时候网站如果不想你对它编程...

HttpClient学习-关于SSL、多线程处理

关于SSL、多线程处理部分。    1、SSL   借助Java Secure Socket Extension (JSSE),HttpClient全面支持Secure Sockets Layer (SSL)或IETF Transport Layer Security (TLS)协议上的HTTP。JSSE已经jre1.4及以后的版本中,以前的版本则需要手工安装设置,具体过程参见Sun网站或学习笔记一   HttpClient中使用SSL非常简单,参考下面两个例子: Ht...

HttpClient学习-字符编码、cookie处理部分

连续三天外出听讲座,httpclient的学习耽误了。今天学习字符编码、cookie处理部分以及如何排错。    1、字符编码(character encoding)   一个HTTP协议的请求或应答的头部(在http协议中,数据包分为两部分,一部分是头部,由一些名值对构成,一部分是主体(body),是真正传办理的数据(如HTML页面等)),必须以US-ASCII编码,这是因为头部不传数据...

HttpClient认证、重定向

下面学习与http客户端相关的认证、重定向等内容。   1、认证   HttpClient三种不同的认证方案: Basic, Digest and NTLM. 这些方案可用于服务器或代理对客户端的认证,简称服务器认证或代理认证。 1)服务器认证(Server Authentication)   HttpClient处理服务器认证几乎是透明的,仅需要开发人员提供登录信息(login credentials)。登录信息保...