[ Index ] |
|
Code source de PHP PEAR 1.4.5 |
[Code source] [Imprimer] [Statistiques]
(pas de description)
Poids: | 296 lignes (10 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 2 fichiers Cache.php HTTP/Request.php |
Cache_HTTP_Request:: (8 méthodes):
Cache_HTTP_Request()
_Cache_HTTP_Request()
getResponseBody()
getResponseCode()
getResponseHeader()
setMode()
sendRequest()
_sendRequestAndGetResponse()
Classe: Cache_HTTP_Request - X-Ref
HTTP_Request CacheCache_HTTP_Request($url, $params = NULL, $container = 'file',$containerOptions = NULL, $expires = 3600,$mode = CACHE_HTTP_REQUEST_KEEP_LOCAL_COPY) X-Ref |
Constructor param: $url The url to access param: $params Associative array of parameters which can be: param: string $container Name of container class param: array $containerOptions Array with container class options param: int $mode What to do when the remote server is down : param: int $expires lifetime of the cached data in seconds - 0 for endless |
_Cache_HTTP_Request() X-Ref |
Deconstructor |
getResponseBody() X-Ref |
Get and return the response body (NULL if no data available) return: mixed response body |
getResponseCode() X-Ref |
Get and return the response code (NULL if no data available) return: mixed response code |
getResponseHeader() X-Ref |
Get and return the response header (NULL if no data available) return: mixed response header |
setMode($newMode) X-Ref |
Set a new mode when the server is down param: int $newMode What to do when the remote server is down : |
sendRequest() X-Ref |
Send the HTTP request or use the cache system If there is a cache file for this HTTP request, the request is not re-sent. Cached response is used. Yet, if the cache is expired, the HTTP request is re-sent. Then, if the remote server is down, this method will return : (depending on the selected mode) - false or - a PEAR_Error or (better) - true and the local copy of the latest valid response will be used. (technical) For the last choice, there is a technical tips. Indeed, there are two cache files. The first one (id key) is a classical one with the given lifetime. But it can be removed by automatic garbage collection for example. So to be able to use the latest valid response (when the remote server is dead), we make a second cache file with no lifetime (id2 key). return: mixed true or false or a PEAR_ERROR |
_sendRequestAndGetResponse() X-Ref |
Send HTTP request and get the response return: boolean success or not ? |
Généré le : Sun Feb 25 14:08:00 2007 | par Balluche grâce à PHPXref 0.7 |