![]() |
Bearsampp 2026.9.23
|
Public Member Functions | |
| __construct (&$config, $options=array()) | |
| downloadHttp ($url, $lastmodified=null, $accept=false, $channel=false) | |
| getCache ($url) | |
| getCacheId ($url) | |
| retrieveCacheFirst ($url, $accept=false, $forcestring=false, $channel=false) | |
| retrieveData ($url, $accept=false, $forcestring=false, $channel=false) | |
| saveCache ($url, $contents, $lastmodified, $nochange=false, $cacheid=null) | |
| saveCacheFile ($file, $contents) | |
| useLocalCache ($url, $cacheid=null) | |
Data Fields | |
| $_options | |
| $config | |
| __construct | ( | & | $config, |
| $options = array() ) |
| downloadHttp | ( | $url, | |
| $lastmodified = null, | |||
| $accept = false, | |||
| $channel = false ) |
Efficiently Download a file through HTTP. Returns downloaded file as a string in-memory This is best used for small files
If an HTTP proxy has been configured (http_proxy PEAR_Config setting), the proxy will be used.
| string | $url | the URL to download |
| string | $save_dir | directory to save file in |
| false | string | array | $lastmodified | header values to check against for caching use false to return the header values from this download |
| false | array | $accept | Accept headers to send |
@access public
Definition at line 338 of file REST.php.
References $port, and downloadHttp().
Referenced by downloadHttp(), and retrieveData().
| getCache | ( | $url | ) |
Definition at line 206 of file REST.php.
Referenced by retrieveData(), and useLocalCache().
| getCacheId | ( | $url | ) |
| string | $url |
Definition at line 193 of file REST.php.
Referenced by retrieveData(), and useLocalCache().
| retrieveCacheFirst | ( | $url, | |
| $accept = false, | |||
| $forcestring = false, | |||
| $channel = false ) |
Retrieve REST data, but always retrieve the local cache if it is available.
This is useful for elements that should never change, such as information on a particular release
| string | full URL to this resource |
| array|false | contents of the accept-encoding header |
| boolean | if true, xml will be returned as a string, otherwise, xml will be parsed using PEAR_XMLParser |
Definition at line 57 of file REST.php.
References retrieveData().
| retrieveData | ( | $url, | |
| $accept = false, | |||
| $forcestring = false, | |||
| $channel = false ) |
Retrieve a remote REST resource
| string | full URL to this resource |
| array|false | contents of the accept-encoding header |
| boolean | if true, xml will be returned as a string, otherwise, xml will be parsed using PEAR_XMLParser |
Definition at line 77 of file REST.php.
References $result, downloadHttp(), getCache(), getCacheId(), PEAR_XMLParser\parse(), PEAR_ERROR_RETURN, saveCache(), and useLocalCache().
Referenced by retrieveCacheFirst().
| saveCache | ( | $url, | |
| $contents, | |||
| $lastmodified, | |||
| $nochange = false, | |||
| $cacheid = null ) |
| string | full URL to REST resource |
| string | original contents of the REST resource |
| array | HTTP Last-Modified and ETag headers |
| bool | if true, then the cache id file should be regenerated to trigger a new time-to-live value |
Definition at line 225 of file REST.php.
References $result, and saveCacheFile().
Referenced by retrieveData().
| saveCacheFile | ( | $file, | |
| $contents ) |
Definition at line 273 of file REST.php.
Referenced by saveCache().
| useLocalCache | ( | $url, | |
| $cacheid = null ) |
Definition at line 173 of file REST.php.
References getCache(), and getCacheId().
Referenced by retrieveData().
| $config |
Definition at line 37 of file REST.php.
Referenced by __construct().