How to get the HTTP request for a Java program by grabbing the package tool fiddler

Source: Internet
Author: User

How to get an HTTP request for a Java program by grabbing the package tool fiddler

Source code: Http://www.zuidaima.com/share/1550463683824640.htm

Grab Bag tool Fidder is a very lightweight software that can get browser, program Http,https request.

Encyclopedia Address: http://baike.baidu.com/view/868685.htm

Website address: http://fiddler2.com/

Firefox's Fidder plugin

The Java program requires a proxy to take effect:

Please download the detailed code.

Package Com.zuidaima.http;import Java.io.bufferedreader;import Java.io.inputstreamreader;import Java.net.httpurlconnection;import Java.net.inetsocketaddress;import Java.net.proxy;import java.net.URL;/***@ Author Www.zuidaima.com**/public class Http302redirect {public static void main (string[] args) {try {String url = "/http/ www.zuidaima.com/"; SYSTEM.OUT.PRINTLN ("Access address:" + URL); Proxy proxy = new Proxy (java.net.proxy.type.http,new inetsocketaddress ("127.0.0.1", 8888)); URL serverurl = new URL (URL); HttpURLConnection conn = (httpurlconnection) serverurl.openconnection (proxy); Conn.setrequestmethod ("GET"); Conn.addrequestproperty ("Accept-charset", "UTF-8;"); Conn.addrequestproperty ("User-agent", "mozilla/5.0" (Windows; U Windows NT 5.1; ZH-CN; rv:1.9.2.8) firefox/3.6.8 "), Conn.addrequestproperty (" Referer "," http://javaniu.com/"); Conn.connect (); BufferedReader reader = new BufferedReader (New InputStreamReader (Conn.getinputstream ())); StringBuffer buffer = new StringBuffer (); String line = Reader.readlINE (); while (line! = null) {Buffer.append (line). Append ("\ r \ n"); line = Reader.readline ();} Reader.close (); Conn.disconnect (); SYSTEM.OUT.PRINTLN (buffer);} catch (Exception e) {e.printstacktrace ();}}}


How to get the HTTP request for a Java program by grabbing the package tool fiddler

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.