Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HTTPRequest - Pure Java zero dependency HTTP Request wrapper
#1
About: HTTPRequest is an easy-to-use zero dependency Java wrapper to read from a URL. Support for Cookies, proxies, UserAgent, post data and more.
License: MIT License
Source: https://konloch.com/HTTPRequest/
Download Jar: https://konloch.com/HTTPRequest/releases/
Add as maven dependency:
Code:
<dependency>
  <groupId>com.konloch</groupId>
  <artifactId>HTTPRequest</artifactId>
  <version>2.0.0</version>
</dependency>

How to preform a simple request
Code:
HTTPRequest request = new HTTPRequest(new URL("https://google.com/"));
        
ArrayList<String> webpage = request.read();

for(String line : webpage)
    System.out.println(line);

How to preform a more complex request
Code:
HTTPRequest request = new HTTPRequest(new URL("https://google.com/"));
request.setTimeout(10000);
request.setPostData("postdata=yes&awesome=yup");
request.setReferer("http://google.com/");
request.setCookie("cookies=yes;cool=sure");
request.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 81)));

ArrayList<String> webpage = request.read();
for(String line : webpage)
    System.out.println(line);

for (Map.Entry<String, List<String>> k : request.getLastConnectionHeaders())
    System.out.println("Header Value:" + k.toString());
Reply
 


Forum Jump:


Users browsing this thread: 2 Guest(s)

About The Bytecode Club

We're a community forum focused on Reverse Engineering, we try to target Java/Android but we also include other langauges/platforms. We pride ourselves in supporting and free and open sourced applications.

Website