[转] Programming submission form

xiaoxiao2021-03-06  19

char accept [] = "Accept: * / *"; char frmdata [] = "param1 = str1 & param2 = str2 & param3 = str3"; HINTERNET hSession = InternetOpen ( "MyAgent", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); HINTERNET hConnect = InternetConnect (hSession, "www.target.com", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1); HINTERNET hRequest = HttpOpenRequest (hConnect, "POST", "filename.php", NULL, NULL, (LPCSTR *) & accept , INTERNET_FLAG_NO_COOKIES, 1); HttpSendRequest (hRequest, "Content-Type: application / x-www-form-urlencoded", -1, (LPVOID) frmdata, sizeof (frmdata)); InternetCloseHandle (hRequest); InternetCloseHandle (hConnect); InternetCloseHandle (HSESSION);

Description:

FRMDATA is form data, where the table single parameter is used by & separation; the second parameter of HttPopenRequest uses POST, indicating the submission form.

转载请注明原文地址:https://www.9cbs.com/read-56597.html

New Post(0)