LInetHttp::SendRequest

#include "ltwrappr.h"

L_INT LInetHttp::SendRequest(pszHeader, ulHeaderSize, pszOptional, ulOptionalSize)

L_TCHAR *pszHeader;

/* pointer to header data */

L_UINT32 ulHeaderSize;

/* sizeof the header data */

L_TCHAR *pszOptional;

/* optional data */

L_UINT32 ulOptionalSize;

/* sizeof the optional data */

Sends an HTTP request to the HTTP server.

Parameter

Description

pszHeader

Pointer to any additional header data to be sent along with the request. This parameter can be NULL if there are no additional headers to append.

ulHeaderSize

Size of the data in pszHeader.

pszOptional

Pointer to any optional data to be sent after the HTTP header. 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.

ulOptionalSize

Size of the data in pszOptional.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

LInetHttp::OpenRequest, LInetHttp::SendBitmap, LInetHttp::SendData, LInetHttp::SendForm, Class Members

Topics:

HTTP Functions: Sending / Getting Data

 

How to Program with the LInetHttp Class

Example

This sample sends a request to the HTTP web server.

L_INT LInetHttp_SendRequestExample(HWND hWndParent)
{
   L_INT nRet;
   LInetHttp   InetHttp(TEXT("www.leadtools.com"));
   // Checking if the connection failed
   nRet = InetHttp.GetErrorFromList ();
   if(nRet != SUCCESS)
   {
      InetHttp.DisplayError (hWndParent, TEXT("Can't connect to the HTTP web server"));
      return nRet;
   }
   nRet = InetHttp.OpenRequest (HTTP_POST, TEXT("/default.htm"));
   if(nRet != SUCCESS)
   {
      InetHttp.DisplayError(hWndParent, TEXT("Can't open a request"));
      return nRet;
   }
   nRet = InetHttp.SendRequest(NULL, 0, NULL, 0);
   if(nRet != SUCCESS)
   {
      InetHttp.DisplayError (hWndParent, TEXT("Can't send a request, an error may occurred"));
      return nRet;
   }
   return SUCCESS;
}