Wininet or winhttp, which is preferred for POST requests

I was looking at the MSDN page comparing WinInet and WinHttp. It seems that WinInet has more functionality than WinHttp. MSDN page here . Under what circumstances can you choose WinHttp over WinInet?

Considering WinInet has HttpSendRequest which can be used for POST data, and WinHttp also has WinHttpSendRequest. What would be the advantages of WinHttp over WinInet? Is there any difference in how data is sent using WinHttp and WinInet?

Also, if some sample POST requests with WinHttp and WinInet help, some small code examples.

EDIT 3 WIRESHARK SCREENSHOT enter image description here

EDIT 2 Finally I was able to get the HTTP_STATUS_CODE from the application and it is 200 OK, but the problem occurs when the post data is sent, it is sent but no parameters are set. I tried to implement this code at the end of PHP.

<?php

    $fp = fopen("data.txt", "a");
    fwrite($fp, "ID = " . $_POST['id']);
    fclose($fp);

?>

      

the file is created as soon as the application starts, but the ID parameter is not set, it writes to the file "ID =" and no more. 10 does not work, I don't know why

Thank.

EDIT: Link to the example I was trying to use. HttpSendRequest for POST form data

+3


source to share


2 answers


In fact MSDN has a good page on WinHTTP vs. WinINet , stating:



With a few exceptions, WinINet is a superset of WinHTTP. When choosing between the two, you should use WinINet unless you plan to work in a service or service process that requires impersonation and session isolation.

+4


source


This example should help you, and if you are interested in the WinInet example you can take a look ...

Next, a quote regarding WinInet from MSDN:



Note. WinINet does not support server implementation. Also, it shouldn't be used from a service. Server implementations or services use Windows HTTP Services (WinHTTP).

This is good advice.

+2


source







All Articles