当前位置: 首页>>代码示例>>Java>>正文


Java HttpBrowser类代码示例

本文整理汇总了Java中jodd.http.HttpBrowser的典型用法代码示例。如果您正苦于以下问题:Java HttpBrowser类的具体用法?Java HttpBrowser怎么用?Java HttpBrowser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HttpBrowser类属于jodd.http包,在下文中一共展示了HttpBrowser类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test

import jodd.http.HttpBrowser; //导入依赖的package包/类
public static void test()throws Exception{
	 HttpBrowser browser = new HttpBrowser();
	 String url = "http://www.dataoke.com/verify";
	 HttpRequest httpRequest =HttpRequest.get(url);
	 httpRequest.header("Host", "www.dataoke.com");
	 httpRequest.header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0");
	 httpRequest.header("Referer", "http://www.dataoke.com/login?user=reg");
	 httpRequest.header("Connection", "keep-alive");
	 httpRequest.header("X-Requested-With", "XMLHttpRequest");
	 
	HttpResponse response = browser.sendRequest(httpRequest);
	//HttpResponse response = httpRequest.send();
	
	
	byte[] bs = response.bodyBytes();
	TestImage.buff2Image(bs,"d:\\test.jpg");
	
	String vc = "";
	
	 String url2 = "http://www.dataoke.com/message?username=15201733862&vc="+vc;
	 httpRequest = HttpRequest.get(url2);
	 httpRequest.header("Host", "www.dataoke.com");
	 httpRequest.header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0");
	 httpRequest.header("Referer", "http://www.dataoke.com/login?user=reg");
	 httpRequest.header("Connection", "keep-alive");
	 httpRequest.header("X-Requested-With", "XMLHttpRequest");
	 
	 response = browser.sendRequest(httpRequest);
	 String rc = response.body();
	 System.out.println(rc);
	 
	 if(rc.contains("1")){
		System.out.println("驗證碼輸入正確>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.");
	 }else{
		 System.out.println("驗證碼輸入錯誤>>>>>>>>>>>>>>>>>>>>>>>>");
	 }
}
 
开发者ID:xiaomin0322,项目名称:alimama,代码行数:38,代码来源:Zhuce.java

示例2: getTitle

import jodd.http.HttpBrowser; //导入依赖的package包/类
/**
 * getTitle receives a url parameter and return a Response object that hoold the page title
 * @param url The HTML page url
 * @return Response
 */
static Response getTitle(String url) {
    HttpBrowser browser = new HttpBrowser();
    HttpRequest request = HttpRequest.get(url);
    browser.sendRequest(request);

    String page = browser.getPage();
    Jerry doc = Jerry.jerry(page);

    return new Response(doc.$("title").text());
}
 
开发者ID:dimiro1,项目名称:gettitle,代码行数:16,代码来源:GetTitleService.java

示例3: main

import jodd.http.HttpBrowser; //导入依赖的package包/类
public static void main(String[] args)throws Exception {
	
	
	Thread.sleep(1000 * 60 * 60);
	browser = new HttpBrowser();
	
	executeAll();
	 
	 
	// HashSet<Integer> hashSet = new HashSet<Integer>();
	 
	// randomSet(0, 400, 50, hashSet);
	
	 //System.out.println(hashSet);
	
	
	//testRandom();
}
 
开发者ID:xiaomin0322,项目名称:alimama,代码行数:19,代码来源:Zhuce.java


注:本文中的jodd.http.HttpBrowser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。