Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
L_InetHttpSendRequest
#include "ltweb.h"
L_LTWEB_API L_INT L_InetHttpSendRequest(hHttp, pszHeader,ulHeaderSize, pszOptional, ulOptionalSize)
HINET hHttp; |
/* handle to an HTTP connection */ |
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 |
hHttp |
Handle to the HTTP connection. It is the same handle obtained using the L_InetHttpConnect function. |
pszHeader |
Pointer to any additional header data to be sent along with the request. This value can be NULL. |
ulHeaderSize |
Size of the data in pszHeader. |
pszOptional |
Pointer to any optional data to be sent after the HTTP header. |
ulOptionalSize |
Size of the data in pszOptional. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
This function can be used to send a request when it is not necessary to send additional data.
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: |
L_InetHttpSendBitmap, L_InetHttpSendData, L_InetHttpSendForm |
Topics: |
|
|
Example
L_INT InetHttpSendRequestExample(L_VOID) { HINET hInet; L_INT nRet; DWORD dwSizeWrite; nRet = L_InetHttpConnect(TEXT("www.leadtools.com"),80,TEXT(""),TEXT(""),&hInet); if(nRet==SUCCESS) { nRet = L_InetHttpOpenRequest(hInet,HTTP_GET,TEXT("/default.htm"),TEXT(""), TEXT("HTTP/1.0"),0); if(nRet==SUCCESS) { L_TCHAR szResponse[2048]; L_UINT32 lsize; L_UINT uStatus; L_HANDLE fp; nRet=L_InetHttpSendRequest(hInet,NULL,0,NULL,0); if(nRet!=SUCCESS) { MessageBox(NULL,TEXT("Error Sending Form"),TEXT("Error"),MB_ICONEXCLAMATION); nRet = L_InetHttpCloseRequest(hInet); if(nRet != SUCCESS) return nRet; nRet = L_InetHttpDisconnect(hInet); if(nRet != SUCCESS) return nRet; return nRet; } nRet = L_InetHttpGetServerStatus(hInet,&uStatus); if(nRet != SUCCESS) return nRet; if(uStatus==L_HTTP_STATUS_OK) { lsize = 2048; nRet = L_InetHttpGetResponse(hInet,(L_CHAR *)szResponse,&lsize); if(nRet != SUCCESS) return nRet; fp =CreateFile(TEXT("output.htm"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); while(lsize!=0) { WriteFile(fp,szResponse, lsize, &dwSizeWrite, NULL); lsize = 1048; L_InetHttpGetResponse(hInet,(L_CHAR *)szResponse,&lsize); } CloseHandle(fp); } else { MessageBox(NULL,TEXT("Problem With Server"),TEXT("Error"),MB_ICONEXCLAMATION); lsize = 2048; nRet = L_InetHttpGetResponse(hInet,(L_CHAR *)szResponse,&lsize); if(nRet != SUCCESS) return nRet; fp =CreateFile(TEXT("error.htm"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); while(lsize!=0) { WriteFile(fp,szResponse, lsize, &dwSizeWrite, NULL); lsize = 1048; nRet = L_InetHttpGetResponse(hInet,(L_CHAR *)szResponse,&lsize); if(nRet != SUCCESS) return nRet; } CloseHandle(fp); } nRet = L_InetHttpCloseRequest(hInet); if(nRet != SUCCESS) return nRet; } else return nRet; nRet = L_InetHttpDisconnect(hInet); if(nRet != SUCCESS) return nRet; } else return nRet; return SUCCESS; }