Advertisement
Guest User

Untitled

a guest
Sep 11th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import java.io.*;
  2. import java.net.*;
  3.  
  4. public class SendPost {
  5. public static void main(String[] args) {
  6. try {
  7. String post_request = "POST /login HTTP/1.1rnHost: localhost:1234rnContent-Length: 41rnContent-Type: application/x-www-form-urlencodedrnrnusername=bob%40test.com&password=i+forget";
  8.  
  9. Socket s = new Socket("localhost", 1234);
  10. DataOutputStream out = new DataOutputStream(s.getOutputStream());
  11. out.writeBytes(post_request);
  12. s.close();
  13. } catch(Exception e) {
  14. System.out.println(e);
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement