Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.net.*;
- public class SendPost {
- public static void main(String[] args) {
- try {
- String post_request = "POST /login HTTP/1.1rnHost: localhost:1234rnContent-Length: 41rnContent-Type: application/x-www-form-urlencodedrnrnusername=bob%40test.com&password=i+forget";
- Socket s = new Socket("localhost", 1234);
- DataOutputStream out = new DataOutputStream(s.getOutputStream());
- out.writeBytes(post_request);
- s.close();
- } catch(Exception e) {
- System.out.println(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement