HttpOpenRequest

Provides information for an HTTP request.

Syntax

    #include <httpexp.h>
    #include <httpclnt.h> 
     
    int HttpOpenRequest (
       HINTERNET   hndl,
       char       *pVerb,
       char       *pObjectName,
       char       *pVersion,
       char       *pReferer,
       char      **ppAcceptTypes);
    

Parameters

hndl
(IN) Specifies the connection handle returned from HttpConnect.
pVerb
(IN) Points to an ASCIIZ string that specifies the verb of the request (for example, GET, PUT, or POST).
pObjectName
(IN) Points to an ASCIIZ string that specifies the path to the object on the server. This is the portion of the URL that follows the domain name or address.
pVersion
(IN) Points to an ASCIIZ string that specifies the HTTP version for the request. If set to NULL, the current default version ("HTTP/1.1") is used for the string.
pReferer
(IN) Points to an ASCIIZ string that is the URL for the HTTP Referer header. If the Referer header is not needed, set the parameter to NULL.
ppAcceptTypes
(IN) Points to a NULL-terminated array of ASCIIZ string pointers that specify the media types accepted in the response. Each media specified is added to the Accept header in the request.

Return Values

If successful, returns 0. Otherwise, returns a nonzero error code.

Decimal

Name

Description

1

ERR_INSUFFICIENT_SPACE

Insufficient space in header buffer.

255

ERR_BAD_PARAMETER

An invalid parameter was passed to the function.

Remarks

The HttpOpenRequest function follows an HttpConnect call and completes the opening of a request. If all your request information is added with this function, it can be followed by the HttpGetReply function, which then both sends the request and receives the reply.

If you need to add more request information, it is followed by an HttpAddRequestHeader... function to add header information and by an HttpSendRequest function to enable the adding of data.

See Also