I am attempting to send a post request like the one described in the title, but I cannot seem to find a good example of a generic piece of code. My work on my project is a bit tedious as I have never used WinHTTP, only libcurl before which is why I decided to ask here. To reiterate, the http request is a post request with specific header values and json data in the request body which is sent through a proxy to a website using winHTTP. If anyone could provide me with assistance, it would be greatly appreciated.
Asked
Active
Viewed 311 times
1
-
1What have you tried so far that is not working for you? – Remy Lebeau Feb 22 '21 at 04:17
-
@RemyLebeau I have attempted to use some examples that I found, but I still did not understand it too well and I got stuck in a debugging rabbit hole with large pieces of code that were encoded differently. I am not a very experienced programmer either which is why I am looking to find a solid example that I could look at. – Bruhman Feb 22 '21 at 04:27
-
1Does the example here not help? Or did I misunderstand the question? https://learn.microsoft.com/en-us/windows/win32/winhttp/winhttp-sessions-overview It doesn't include the proxy part, but to connect through a proxy you connect to the proxy and then send a CONNECT command to it before sending the POST command to the destination. – Jerry Jeremiah Feb 22 '21 at 04:30
-
To use a proxy with WinHTTP, you simply specify the proxy in the `pszProxy` parameter of `WinHTTPOpen()`. You don't send a `CONNECT` request yourself, WinHTTP will handle that internally – Remy Lebeau Feb 22 '21 at 05:20