I am trying to make HTTP Requests from Delphi using the WinInet functions.
So far I have:
function request:string;
var
hNet,hURL,hRequest: HINTERNE
The third parameter (lpszObjectName) to HttpOpenRequest should be the URL you wish to request. That's why the documentation describes the fifth parameter (lpszReferer) as "a pointer to a null-terminated string that specifies the URL of the document from which the URL in the request (lpszObjectName) was obtained."
The posted data gets sent with HttpSendRequest; the lpOptional parameter is described like this:
Pointer to a buffer containing any optional data to be sent immediately after the request headers. This parameter is generally used for POST and PUT operations. The optional data can be the resource or information being posted to the server. This parameter can be NULL if there is no optional data to send.
The second parameter to InternetOpen should be just the server name; it should not include the protocol. The protocol you specify with the sixth parameter.
After you've sent the request, you can read the response with InternetReadFile and InternetQueryDataAvailable.
Don't just check whether the API functions return zero and then proceed on the next line. If they fail, call GetLastError to find out why. The code you've posted will not raise exceptions, so it's futile to catch any. (And it's foolish to "handle" them the way you're doing so anyway. Don't catch an exception that you don't already know how to fix. Let everything else go up to the caller, or the caller's caller, etc.)