Chilkat.HttpRequest PHP Reference
Chilkat.HttpRequest
Represents a complete HTTP request.
Object Creation
$obj = new COM("Chilkat.HttpRequest");
Properties
string Charset
Controls the character encoding used for HTTP request parameters for POST requests. The default value is "utf-8". The charset should match the charset expected by the form target.
string HttpVersion
The HTTP version in the request header. Defaults to "1.1".
string LastErrorHtml (read-only)
Error information in HTML format for the last method called.
string LastErrorText (read-only)
Error information in plain-text format for the last method called.
string LastErrorXml (read-only)
Error information in XML format for the last method called.
int NumHeaderFields (read-only)
Returns the number of request header fields.
int NumParams (read-only)
Returns the number of query parameters.
string Path
The path of the resource requested. A path of "/" indicates the default document for a domain.
bool SendCharset
Controls whether the charset is explicitly included in the content-type header field of the HTTP POST request.
Methods
bool AddFileForUpload(string name, string filename)
Adds a file to an upload request. To create a file upload request, call UseUpload and then call AddFileForUpload for each file to be uploaded.
void AddHeader(string name, string value)
Adds a request header to the HTTP request. If a header having the same field name is already present, this method replaces it.
void AddParam(string name, string value)
Adds a request query parameter (name/value pair) to the HTTP request. The name and value strings passed to this method should not be URL encoded.
string GenerateRequestText()
Returns the request text that would be sent if Http.SynchronousRequest was called. Returns a null on failure
string GetHeaderField(string name)
Returns the value of a request header field. Returns a null on failure
string GetHeaderName(int index)
Returns the Nth request header field name. Indexing begins at 0, and the number of request header fields is specified by the NumHeaderFields property. Returns a null on failure
string GetHeaderValue(int index)
Returns the Nth request header field value. Indexing begins at 0, and the number of request header fields is specified by the NumHeaderFields property. Returns a null on failure
string GetParam(string name)
Returns a request query parameter value by name. Returns a null on failure
string GetParamName(int index)
Returns the Nth request query parameter field name. Indexing begins at 0, and the number of request query parameter fields is specified by the NumParams property. Returns a null on failure
string GetParamValue(int index)
Returns the Nth request query parameter field value. Indexing begins at 0, and the number of request query parameter fields is specified by the NumParams property. Returns a null on failure
bool LoadBodyFromBytes(VARIANT binaryData)
To be documented soon...
bool LoadBodyFromFile(string filename)
To be documented soon...
bool LoadBodyFromString(string bodyStr)
To be documented soon...
void RemoveAllParams()
Removes all request parameters.
void RemoveParam(string name)
Removes a single HTTP request parameter by name.
bool SaveLastError(string filename)
Saves the last error information to an XML formatted file.
string Serialize()
Serializes the HttpRequest object to a string. Returns a null on failure
void SetFromUrl(string url)
Parses a URL and sets the Path and query parameters (NumParams, GetParam, GetParamName, GetParamValue).
void UseGet()
Makes the HttpRequest a GET request.
void UseHead()
Makes the HttpRequest a HEAD request.
void UsePost()
Makes the HttpRequest a POST request that uses the "application/x-www-form-urlencoded" content type.
void UseUpload()
Makes the HttpRequest a POST request that uses the "multipart/form-data" content type. To create a file upload request, call UseUpload and then call AddFileForUpload for each file to be uploaded.
void UseXmlHttp(string xmlDoc)
Makes the HttpRequest a POST request using the "text/xml" content type. The request body is set to the XML string passed to this method.
|