Property | Type | Description | |
---|---|---|---|
$_fileInfoDb | resource | This variable is populated the first time _detectFileMimeType is called and is then reused on every call to this method | |
$_queryBracketsEscaped | boolean | Status if the http_build_query function escapes brackets | |
$_unmaskStatus | boolean | Status for unmasking GET array params | |
$adapter | Zend_Http_Client_Adapter_Interface | The adapter used to perform the actual connection to the server | |
$auth | array | null | Expected to be an associative array with this structure: $this->auth = array('user' => 'username', 'password' => 'password', 'type' => 'basic') Where 'type' should be one of the supported authentication types (see the AUTH_* constants), for example 'basic' or 'digest'. If null, no authentication will be used. | |
$body_field_order | array | An associative array, where each element is of the format:
' |
|
$config | array | Configuration array, set using the constructor or using ::setConfig() | |
$cookiejar | Zend_Http_CookieJar | The client's cookie jar | |
$enctype | string | Request body content type (for POST requests) | |
$files | array | An associative array, where each element is of the format: 'name' => array('filename.txt', 'text/plain', 'This is the actual file contents') | |
$headers | array | Associative array of request headers | |
$last_request | string | The last HTTP request sent by the client, as string | |
$last_response | Zend_Http_Response | The last HTTP response received by the client | |
$method | string | HTTP request method | |
$paramsGet | array | Associative array of GET parameters | |
$paramsPost | array | Associative array of POST parameters | |
$raw_post_data | string | The raw post data to send. Could be set by setRawData($data, $enctype). | |
$redirectCounter | integer | Redirection counter | |
$uri | Zend_Uri_Http | Request URI |
Method | Description | |
---|---|---|
__construct ( Zend_Uri_Http | string $uri = null, array $config = null ) | Constructor method. Will create a new HTTP client. Accepts the target URL and optionally configuration array. | |
encodeAuthHeader ( string $user, string $password, string $type = self::AUTH_BASIC ) : string | Create a HTTP authentication "Authorization:" header according to the specified user, password and authentication method. | |
encodeFormData ( string $boundary, string $name, mixed $value, string $filename = null, array $headers = [] ) : string | Encode data to a multipart/form-data part suitable for a POST request. | |
getAdapter ( ) : Zend_Http_Client_Adapter_Interface | Load the connection adapter | |
getCookieJar ( ) : Zend_Http_CookieJar | null | Return the current cookie jar or null if none. | |
getHeader ( string $key ) : string | array | null | Get the value of a specific header | |
getLastRequest ( ) : string | Get the last HTTP request as string | |
getLastResponse ( ) : Zend_Http_Response | Get the last HTTP response received by this client | |
getRedirectionsCount ( ) : integer | Get the number of redirections done on the last request | |
getStream ( ) : boolean | string | Get status of streaming for received data | |
getUnmaskStatus ( ) : boolean | Returns the currently configured unmask status | |
getUri ( boolean $as_string = false ) : Zend_Uri_Http | string | Get the URI for the next request | |
request ( string $method = null ) : Zend_Http_Response | Send the HTTP request and return an HTTP response object | |
resetParameters ( boolean $clearAll = false ) : Zend_Http_Client | Clear all GET and POST parameters | |
setAdapter ( Zend_Http_Client_Adapter_Interface | string $adapter ) : null | Load the connection adapter | |
setAuth ( string | false $user, string $password = '', string $type = self::AUTH_BASIC ) : Zend_Http_Client | Set HTTP authentication parameters | |
setConfig ( $config = [] ) : Zend_Http_Client | Set configuration parameters for this HTTP client | |
setCookie ( Zend_Http_Cookie | string $cookie, string | null $value = null ) : Zend_Http_Client | Add a cookie to the request. If the client has no Cookie Jar, the cookies will be added directly to the headers array as "Cookie" headers. | |
setCookieJar ( Zend_Http_CookieJar | boolean $cookiejar = true ) : Zend_Http_Client | Set the HTTP client's cookie jar. | |
setEncType ( string $enctype = self::ENC_URLENCODED ) : Zend_Http_Client | Set the encoding type for POST data | |
setFileUpload ( string $filename, string $formname, string $data = null, string $ctype = null ) : Zend_Http_Client | Set a file to upload (using a POST request) | |
setHeaders ( string | array $name, mixed $value = null ) : Zend_Http_Client | Set one or more request headers | |
setMethod ( string $method = self::GET ) : Zend_Http_Client | Set the next request's method | |
setParameterGet ( string | array $name, string $value = null ) : Zend_Http_Client | Set a GET parameter for the request. Wrapper around _setParameter | |
setParameterPost ( string | array $name, string $value = null ) : Zend_Http_Client | Set a POST parameter for the request. Wrapper around _setParameter | |
setRawData ( string | resource $data, string $enctype = null ) : Zend_Http_Client | Set the raw (already encoded) POST data. | |
setStream ( string | boolean $streamfile = true ) : Zend_Http_Client | Set streaming for received data | |
setUnmaskStatus ( boolean $status = true ) : Zend_Http_Client | Set the unmask feature for GET parameters as array | |
setUri ( Zend_Uri_Http | string $uri ) : Zend_Http_Client | Set the URI for the next request |
Method | Description | |
---|---|---|
_detectFileMimeType ( string $file ) : string | Attempt to detect the MIME type of a file using available extensions | |
_flattenParametersArray ( array $parray, string $prefix = null ) : array | Convert an array of parameters into a flat array of (key, value) pairs | |
_getParametersRecursive ( array $parray, boolean $urlencode = false ) : array | Helper method that gets a possibly multi-level parameters array (get or post) and flattens it. | |
_openTempStream ( ) : resource | Create temporary stream | |
_prepareBody ( ) : string | Prepare the request body (for POST and PUT requests) | |
_prepareHeaders ( ) : array | Prepare the request headers | |
_setParameter ( string $type, string $name, string $value ) : null | Set a GET or POST parameter - used by SetParameterGet and SetParameterPost |
public __construct ( Zend_Uri_Http | string $uri = null, array $config = null ) | ||
$uri | Zend_Uri_Http | string | |
$config | array | Configuration key-value pairs. |
protected _detectFileMimeType ( string $file ) : string | ||
$file | string | File path |
return | string | MIME type |
protected _openTempStream ( ) : resource | ||
return | resource |
protected _prepareBody ( ) : string | ||
return | string |
protected _prepareHeaders ( ) : array | ||
return | array |
public static encodeFormData ( string $boundary, string $name, mixed $value, string $filename = null, array $headers = [] ) : string | ||
$boundary | string | |
$name | string | |
$value | mixed | |
$filename | string | |
$headers | array | Associative array of optional headers @example ("Content-Transfer-Encoding" => "binary") |
return | string |
public getAdapter ( ) : Zend_Http_Client_Adapter_Interface | ||
return | Zend_Http_Client_Adapter_Interface | $adapter |
public getCookieJar ( ) : Zend_Http_CookieJar | null | ||
return | Zend_Http_CookieJar | null |
public getLastRequest ( ) : string | ||
return | string |
public getLastResponse ( ) : Zend_Http_Response | ||
return | Zend_Http_Response | or null if none |
public getRedirectionsCount ( ) : integer | ||
return | integer |
public getUnmaskStatus ( ) : boolean | ||
return | boolean |
public resetParameters ( boolean $clearAll = false ) : Zend_Http_Client | ||
$clearAll | boolean | Should all data be cleared? |
return | Zend_Http_Client |
public setAdapter ( Zend_Http_Client_Adapter_Interface | string $adapter ) : null | ||
$adapter | Zend_Http_Client_Adapter_Interface | string | |
return | null |
$this->setAuth('shahar', 'secret', Zend_Http_Client::AUTH_BASIC);
To disable authentication:
$this->setAuth(false);
public setConfig ( $config = [] ) : Zend_Http_Client | ||
return | Zend_Http_Client |
public setCookieJar ( Zend_Http_CookieJar | boolean $cookiejar = true ) : Zend_Http_Client | ||
$cookiejar | Zend_Http_CookieJar | boolean | Existing cookiejar object, true to create a new one, false to disable |
return | Zend_Http_Client |
public setEncType ( string $enctype = self::ENC_URLENCODED ) : Zend_Http_Client | ||
$enctype | string | |
return | Zend_Http_Client |
public setFileUpload ( string $filename, string $formname, string $data = null, string $ctype = null ) : Zend_Http_Client | ||
$filename | string | Name of file to upload, or name to save as |
$formname | string | Name of form element to send as |
$data | string | Data to send (if null, $filename is read and sent) |
$ctype | string | Content type to use (if $data is set and $ctype is null, will be application/octet-stream) |
return | Zend_Http_Client |
public setRawData ( string | resource $data, string $enctype = null ) : Zend_Http_Client | ||
$data | string | resource | |
$enctype | string | |
return | Zend_Http_Client |
public setUnmaskStatus ( boolean $status = true ) : Zend_Http_Client | ||
$status | boolean | |
return | Zend_Http_Client |
protected static resource $_fileInfoDb | ||
return | resource |
protected bool $_queryBracketsEscaped | ||
return | boolean |
protected bool $_unmaskStatus | ||
return | boolean |
protected Zend_Http_Client_Adapter_Interface $adapter | ||
return | Zend_Http_Client_Adapter_Interface |
protected array $body_field_order | ||
return | array |
protected array $config | ||
return | array |
protected Zend_Http_CookieJar $cookiejar | ||
return | Zend_Http_CookieJar |
protected string $enctype | ||
return | string |
protected array $files | ||
return | array |
protected array $headers | ||
return | array |
protected string $last_request | ||
return | string |
protected Zend_Http_Response $last_response | ||
return | Zend_Http_Response |
protected array $paramsGet | ||
return | array |
protected array $paramsPost | ||
return | array |
protected string $raw_post_data | ||
return | string |
protected int $redirectCounter | ||
return | integer |