Advertisement
cos8o

Post request without libraries (WIP)

Apr 30th, 2017
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. int postRequest() {
  2.     WSAData wsaData;
  3.     WORD DllVersion = MAKEWORD(2, 1);
  4.     if (WSAStartup(DllVersion, &wsaData) != 0) {
  5.         MessageBoxA(NULL, "Cannot start up the ", "error1", MB_OK);
  6.             exit(1);
  7.     }
  8.     SOCKADDR_IN addr;
  9.     int sizeofaddr = sizeof(addr);
  10.     addr.sin_addr.s_addr = inet_addr("185.27.134.141");
  11.     addr.sin_port = htons(80);
  12.     addr.sin_family = AF_INET;
  13.     SOCKET Connection = socket(AF_INET, SOCK_STREAM, NULL);
  14.     if (connect(Connection, (SOCKADDR*)&addr, sizeofaddr) != 0) {
  15.         MessageBoxA(NULL, "error2", "error2", MB_OK);
  16.         return 0;
  17.     }
  18.     char header[] = "POST /searchLevel.php HTTP/1.1\r\n"
  19.         "Host: dnz2dnz2y29zog8.epizy.com\r\n"
  20.         "Content-Type: application/x-www-form-urlencoded\r\n"
  21.         "Content-Length: 10\r\n"
  22.         "Connection: close\r\n"
  23.         "\r\n"
  24.         "author=lol";
  25.     send(Connection, header, strlen(header), 0);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement