我浏览了比较 WinInet 和 WinHttp 的 MSDN 页面。似乎 WinInet 比 WinHttp 具有更多的功能。 MSDN 页面是 here .什么情况下会选择 WinHttp 而不是 WinInet?
考虑到 WinInet 具有可用于 POST 数据的 HttpSendRequest,并且 WinHttp 也具有 WinHttpSendRequest。采用 WinHttp 而不是 WinInet 的优势是什么?使用 WinHttp 和 WinInet 发布数据的方式有区别吗?
此外,如果使用 WinHttp 和 WinInet 的 POST 请求的一些示例会有所帮助,一些小示例代码。
编辑 3 WIRESHARK 屏幕截图
EDIT 2 我终于设法从应用程序中获取了 HTTP_STATUS_CODE 并且它是 200 OK 但问题出现在发送发布数据时,它已发送但未设置参数。我尝试在 PHP 端实现此代码。
<?php
$fp = fopen("data.txt", "a");
fwrite($fp, "ID = " . $_POST['id']);
fclose($fp);
?>
应用程序运行后立即创建文件,但未设置 ID 参数,它写入文件 “ID =”,仅此而已。 10 没有通过,不知道为什么
谢谢。
编辑:链接到我尝试使用的示例。 HttpSendRequest to POST form data
最佳答案
实际上 MSDN 在 WinHTTP vs. WinINet 上有一个很好的页面,说明:
With a few exceptions, WinINet is a superset of WinHTTP. When selecting between the two, you should use WinINet, unless you plan to run within a service or service-like process that requires impersonation and session isolation.
关于c++ - wininet 或 winhttp,这是 POST 请求的首选,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25782184/