在向服务器发布帖子之前我需要添加任何标头吗?
例如,目前我正在尝试以这种方式发送请求和发布数据,
LPCWSTR post = L"name=User&subject=Hi&message=Hi";
if (!(WinHttpSendRequest( hRequest,
WINHTTP_NO_ADDITIONAL_HEADERS,
0, (LPVOID)post, wcslen(post),
wcslen(post), 0)))
{
//error
}
这应该有效吗?
对我有用的:
LPSTR post = "log=test";//in my php file: if(isset($_POST['log']))
hRequest = WinHttpOpenRequest(hConnect,
L"POST",
L"/test.php",
NULL,
WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
0);
bResults = WinHttpSendRequest(hRequest,
L"content-type:application/x-www-form-urlencoded",
-1,
post,
strlen(post),
strlen(post),
NULL);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)