[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Source view] [Print] [Project Stats]
Zend Framework LICENSE
Copyright: | Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
License: | http://framework.zend.com/license/new-bsd New BSD License |
Version: | $Id$ |
File Size: | 1460 lines (46 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Zend_Http_Client:: (34 methods):
__construct()
setUri()
getUri()
setConfig()
setMethod()
setHeaders()
getHeader()
setParameterGet()
setParameterPost()
_setParameter()
getRedirectionsCount()
setAuth()
setCookieJar()
getCookieJar()
setCookie()
setFileUpload()
setEncType()
setRawData()
resetParameters()
getLastRequest()
getLastResponse()
setAdapter()
getAdapter()
setStream()
getStream()
_openTempStream()
request()
_prepareHeaders()
_prepareBody()
_getParametersRecursive()
_detectFileMimeType()
encodeFormData()
encodeAuthHeader()
_flattenParametersArray()
Class: Zend_Http_Client - X-Ref
Zend_Http_Client is an implemetation of an HTTP client in PHP. The client__construct($uri = null, $config = null) X-Ref |
Contructor method. Will create a new HTTP client. Accepts the target URL and optionally configuration array. param: Zend_Uri_Http|string $uri param: array $config Configuration key-value pairs. |
setUri($uri) X-Ref |
Set the URI for the next request param: Zend_Uri_Http|string $uri return: Zend_Http_Client |
getUri($as_string = false) X-Ref |
Get the URI for the next request param: boolean $as_string If true, will return the URI as a string return: Zend_Uri_Http|string |
setConfig($config = array() X-Ref |
Set configuration parameters for this HTTP client param: Zend_Config | array $config return: Zend_Http_Client |
setMethod($method = self::GET) X-Ref |
Set the next request's method Validated the passed method and sets it. If we have files set for POST requests, and the new method is not POST, the files are silently dropped. param: string $method return: Zend_Http_Client |
setHeaders($name, $value = null) X-Ref |
Set one or more request headers This function can be used in several ways to set the client's request headers: 1. By providing two parameters: $name as the header to set (eg. 'Host') and $value as it's value (eg. 'www.example.com'). 2. By providing a single header string as the only parameter eg. 'Host: www.example.com' 3. By providing an array of headers as the first parameter eg. array('host' => 'www.example.com', 'x-foo: bar'). In This case the function will call itself recursively for each array item. param: string|array $name Header name, full header string ('Header: value') param: mixed $value Header value or null return: Zend_Http_Client |
getHeader($key) X-Ref |
Get the value of a specific header Note that if the header has more than one value, an array will be returned. param: string $key return: string|array|null The header value or null if it is not set |
setParameterGet($name, $value = null) X-Ref |
Set a GET parameter for the request. Wrapper around _setParameter param: string|array $name param: string $value return: Zend_Http_Client |
setParameterPost($name, $value = null) X-Ref |
Set a POST parameter for the request. Wrapper around _setParameter param: string|array $name param: string $value return: Zend_Http_Client |
_setParameter($type, $name, $value) X-Ref |
Set a GET or POST parameter - used by SetParameterGet and SetParameterPost param: string $type GET or POST param: string $name param: string $value return: null |
getRedirectionsCount() X-Ref |
Get the number of redirections done on the last request return: int |
setAuth($user, $password = '', $type = self::AUTH_BASIC) X-Ref |
Set HTTP authentication parameters $type should be one of the supported types - see the self::AUTH_* constants. To enable authentication: <code> $this->setAuth('shahar', 'secret', Zend_Http_Client::AUTH_BASIC); </code> To disable authentication: <code> $this->setAuth(false); </code> param: string|false $user User name or false disable authentication param: string $password Password param: string $type Authentication type return: Zend_Http_Client |
setCookieJar($cookiejar = true) X-Ref |
Set the HTTP client's cookie jar. A cookie jar is an object that holds and maintains cookies across HTTP requests and responses. param: Zend_Http_CookieJar|boolean $cookiejar Existing cookiejar object, true to create a new one, false to disable return: Zend_Http_Client |
getCookieJar() X-Ref |
Return the current cookie jar or null if none. return: Zend_Http_CookieJar|null |
setCookie($cookie, $value = null) X-Ref |
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. param: Zend_Http_Cookie|string $cookie param: string|null $value If "cookie" is a string, this is the cookie value. return: Zend_Http_Client |
setFileUpload($filename, $formname, $data = null, $ctype = null) X-Ref |
Set a file to upload (using a POST request) Can be used in two ways: 1. $data is null (default): $filename is treated as the name if a local file which will be read and sent. Will try to guess the content type using mime_content_type(). 2. $data is set - $filename is sent as the file name, but $data is sent as the file contents and no file is read from the file system. In this case, you need to manually set the Content-Type ($ctype) or it will default to application/octet-stream. param: string $filename Name of file to upload, or name to save as param: string $formname Name of form element to send as param: string $data Data to send (if null, $filename is read and sent) param: string $ctype Content type to use (if $data is set and $ctype is return: Zend_Http_Client |
setEncType($enctype = self::ENC_URLENCODED) X-Ref |
Set the encoding type for POST data param: string $enctype return: Zend_Http_Client |
setRawData($data, $enctype = null) X-Ref |
Set the raw (already encoded) POST data. This function is here for two reasons: 1. For advanced user who would like to set their own data, already encoded 2. For backwards compatibilty: If someone uses the old post($data) method. this method will be used to set the encoded data. $data can also be stream (such as file) from which the data will be read. param: string|resource $data param: string $enctype return: Zend_Http_Client |
resetParameters($clearAll = false) X-Ref |
Clear all GET and POST parameters Should be used to reset the request parameters if the client is used for several concurrent requests. clearAll parameter controls if we clean just parameters or also headers and last_* param: bool $clearAll Should all data be cleared? return: Zend_Http_Client |
getLastRequest() X-Ref |
Get the last HTTP request as string return: string |
getLastResponse() X-Ref |
Get the last HTTP response received by this client If $config['storeresponse'] is set to false, or no response was stored yet, will return null return: Zend_Http_Response or null if none |
setAdapter($adapter) X-Ref |
Load the connection adapter While this method is not called more than one for a client, it is seperated from ->request() to preserve logic and readability param: Zend_Http_Client_Adapter_Interface|string $adapter return: null |
getAdapter() X-Ref |
Load the connection adapter return: Zend_Http_Client_Adapter_Interface $adapter |
setStream($streamfile = true) X-Ref |
Set streaming for received data param: string|boolean $streamfile Stream file, true for temp file, false/null for no streaming return: Zend_Http_Client |
getStream() X-Ref |
Get status of streaming for received data return: boolean|string |
_openTempStream() X-Ref |
Create temporary stream return: resource |
request($method = null) X-Ref |
Send the HTTP request and return an HTTP response object param: string $method return: Zend_Http_Response |
_prepareHeaders() X-Ref |
Prepare the request headers return: array |
_prepareBody() X-Ref |
Prepare the request body (for POST and PUT requests) return: string |
_getParametersRecursive($parray, $urlencode = false) X-Ref |
Helper method that gets a possibly multi-level parameters array (get or post) and flattens it. The method returns an array of (key, value) pairs (because keys are not necessarily unique. If one of the parameters in as array, it will also add a [] suffix to the key. This method is deprecated since Zend Framework 1.9 in favour of self::_flattenParametersArray() and will be dropped in 2.0 param: array $parray The parameters array param: bool $urlencode Whether to urlencode the name and value return: array |
_detectFileMimeType($file) X-Ref |
Attempt to detect the MIME type of a file using available extensions This method will try to detect the MIME type of a file. If the fileinfo extension is available, it will be used. If not, the mime_magic extension which is deprected but is still available in many PHP setups will be tried. If neither extension is available, the default application/octet-stream MIME type will be returned param: string $file File path return: string MIME type |
encodeFormData($boundary, $name, $value, $filename = null, $headers = array() X-Ref |
Encode data to a multipart/form-data part suitable for a POST request. param: string $boundary param: string $name param: mixed $value param: string $filename param: array $headers Associative array of optional headers @example ("Content-Transfer-Encoding" => "binary") return: string |
encodeAuthHeader($user, $password, $type = self::AUTH_BASIC) X-Ref |
Create a HTTP authentication "Authorization:" header according to the specified user, password and authentication method. param: string $user param: string $password param: string $type return: string |
_flattenParametersArray($parray, $prefix = null) X-Ref |
Convert an array of parameters into a flat array of (key, value) pairs Will flatten a potentially multi-dimentional array of parameters (such as POST parameters) into a flat array of (key, value) paris. In case of multi-dimentional arrays, square brackets ([]) will be added to the key to indicate an array. param: array $parray param: string $prefix return: array |
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |