PHTTPClient Class Reference
#include <http.h>
List of all members.
Public Member Functions |
| PHTTPClient () |
| Create a new HTTP client channel.
|
| PHTTPClient (const PString &userAgentName) |
int | ExecuteCommand (Commands cmd, const PURL &url, PMIMEInfo &outMIME, const PString &dataBody, PMIMEInfo &replyMime, BOOL persist=TRUE) |
int | ExecuteCommand (const PString &cmdName, const PURL &url, PMIMEInfo &outMIME, const PString &dataBody, PMIMEInfo &replyMime, BOOL persist=TRUE) |
BOOL | WriteCommand (Commands cmd, const PString &url, PMIMEInfo &outMIME, const PString &dataBody) |
| Write a HTTP command to server.
|
BOOL | WriteCommand (const PString &cmdName, const PString &url, PMIMEInfo &outMIME, const PString &dataBody) |
BOOL | ReadResponse (PMIMEInfo &replyMIME) |
| Read a response from the server.
|
BOOL | ReadContentBody (PMIMEInfo &replyMIME, PBYTEArray &body) |
| Read the body of the HTTP command.
|
BOOL | ReadContentBody (PMIMEInfo &replyMIME, PString &body) |
BOOL | GetTextDocument (const PURL &url, PString &document, BOOL persist=TRUE) |
BOOL | GetDocument (const PURL &url, PMIMEInfo &outMIME, PMIMEInfo &replyMIME, BOOL persist=TRUE) |
BOOL | GetHeader (const PURL &url, PMIMEInfo &outMIME, PMIMEInfo &replyMIME, BOOL persist=TRUE) |
BOOL | PostData (const PURL &url, PMIMEInfo &outMIME, const PString &data, PMIMEInfo &replyMIME, BOOL persist=TRUE) |
BOOL | PostData (const PURL &url, PMIMEInfo &outMIME, const PString &data, PMIMEInfo &replyMIME, PString &replyBody, BOOL persist=TRUE) |
Protected Member Functions |
BOOL | AssureConnect (const PURL &url, PMIMEInfo &outMIME) |
BOOL | InternalReadContentBody (PMIMEInfo &replyMIME, PAbstractArray &body) |
Protected Attributes |
PString | userAgentName |
Detailed Description
A TCP/IP socket for the HyperText Transfer Protocol version 1.0.
When acting as a client, the procedure is to make the connection to a remote server, then to retrieve a document using the following procedure:
PHTTPSocket web("webserver");
if (web.IsOpen()) {
PINDEX len;
if (web.GetDocument("http://www.someone.com/somewhere/url", len)) {
PString html = web.ReadString(len);
if (!html.IsEmpty())
ProcessHTML(html);
}
else
PError << "Could not get page." << endl;
}
else
PError << "HTTP conection failed." << endl;
Constructor & Destructor Documentation
PHTTPClient::PHTTPClient |
( |
|
) |
|
Create a new HTTP client channel.
PHTTPClient::PHTTPClient |
( |
const PString & |
userAgentName |
) |
|
Member Function Documentation
BOOL PHTTPClient::AssureConnect |
( |
const PURL & |
url, |
|
|
PMIMEInfo & |
outMIME | |
|
) |
| | [protected] |
Send a command and wait for the response header (including MIME fields). Note that a body may still be on its way even if lasResponseCode is not 200!
- Returns:
- TRUE if all of header returned and ready to receive body.
BOOL PHTTPClient::GetDocument |
( |
const PURL & |
url, |
|
|
PMIMEInfo & |
outMIME, |
|
|
PMIMEInfo & |
replyMIME, |
|
|
BOOL |
persist = TRUE | |
|
) |
| | |
Get the document specified by the URL.
- Returns:
- TRUE if document is being transferred.
- Parameters:
-
| url | Universal Resource Locator for document. |
| outMIME | MIME info in request |
| replyMIME | MIME info in response |
| persist | if TRUE, enable HTTP persistence |
BOOL PHTTPClient::GetHeader |
( |
const PURL & |
url, |
|
|
PMIMEInfo & |
outMIME, |
|
|
PMIMEInfo & |
replyMIME, |
|
|
BOOL |
persist = TRUE | |
|
) |
| | |
Get the header for the document specified by the URL.
- Returns:
- TRUE if document header is being transferred.
- Parameters:
-
| url | Universal Resource Locator for document. |
| outMIME | MIME info in request |
| replyMIME | MIME info in response |
| persist | if TRUE, enable HTTP persistence |
BOOL PHTTPClient::GetTextDocument |
( |
const PURL & |
url, |
|
|
PString & |
document, |
|
|
BOOL |
persist = TRUE | |
|
) |
| | |
Get the document specified by the URL.
- Returns:
- TRUE if document is being transferred.
- Parameters:
-
| url | Universal Resource Locator for document. |
| document | Body read |
| persist | if TRUE, enable HTTP persistence |
Post the data specified to the URL.
- Returns:
- TRUE if document is being transferred.
- Parameters:
-
| url | Universal Resource Locator for document. |
| outMIME | MIME info in request |
| data | Information posted to the HTTP server. |
| replyMIME | MIME info in response |
| replyBody | Body of response |
| persist | if TRUE, enable HTTP persistence |
Post the data specified to the URL.
- Returns:
- TRUE if document is being transferred.
- Parameters:
-
| url | Universal Resource Locator for document. |
| outMIME | MIME info in request |
| data | Information posted to the HTTP server. |
| replyMIME | MIME info in response |
| persist | if TRUE, enable HTTP persistence |
Read the body of the HTTP command.
BOOL PHTTPClient::ReadResponse |
( |
PMIMEInfo & |
replyMIME |
) |
|
Read a response from the server.
Write a HTTP command to server.
Member Data Documentation
The documentation for this class was generated from the following file: