PEAR
[ class tree: PEAR ] [ index: PEAR ] [ all elements ]

Class: PEAR_REST

Source Location: /PEAR-1.9.4/PEAR/REST.php

Class Overview


Intelligently retrieve data, following hyperlinks if necessary, and re-directing


Author(s):

Version:

  • Release: 1.9.4

Copyright:

  • 1997-2009 The Authors

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 35]
Intelligently retrieve data, following hyperlinks if necessary, and re-directing

as well



[ Top ]


Class Variables

$config =

[line 37]


Type:   mixed


[ Top ]



Method Detail

PEAR_REST (Constructor)   [line 40]

PEAR_REST PEAR_REST( &$config, [ $options = array()])


Parameters:

   &$config     
   $options     

[ Top ]

downloadHttp   [line 325]

string|array downloadHttp( string $url, [false|string|array $lastmodified = null], [false|array $accept = false], [ $channel = false], string $save_dir)

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.

  • Return: Returns the contents of the downloaded file or a PEAR error on failure. If the error is caused by socket-related errors, the error object will have the fsockopen error code available through getCode(). If caching is requested, then return the header values.
  • Access: public

Parameters:

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
   $channel     

[ Top ]

getCache   [line 205]

void getCache( $url)


Parameters:

   $url     

[ Top ]

getCacheId   [line 192]

void getCacheId( $url)


Parameters:

   $url     

[ Top ]

retrieveCacheFirst   [line 57]

string|array retrieveCacheFirst( string $url, [array|false $accept = false], [boolean $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


Parameters:

string   $url     full URL to this resource
array|false   $accept     contents of the accept-encoding header
boolean   $forcestring     if true, xml will be returned as a string, otherwise, xml will be parsed using PEAR_XMLParser
   $channel     

[ Top ]

retrieveData   [line 77]

string|array retrieveData( string $url, [array|false $accept = false], [boolean $forcestring = false], [ $channel = false])

Retrieve a remote REST resource

Parameters:

string   $url     full URL to this resource
array|false   $accept     contents of the accept-encoding header
boolean   $forcestring     if true, xml will be returned as a string, otherwise, xml will be parsed using PEAR_XMLParser
   $channel     

[ Top ]

saveCache   [line 224]

void saveCache( string $url, string $contents, array $lastmodified, [bool $nochange = false], [ $cacheid = null])


Parameters:

string   $url     full URL to REST resource
string   $contents     original contents of the REST resource
array   $lastmodified     HTTP Last-Modified and ETag headers
bool   $nochange     if true, then the cache id file should be regenerated to trigger a new time-to-live value
   $cacheid     

[ Top ]

saveCacheFile   [line 265]

void saveCacheFile( $file, $contents)


Parameters:

   $file     
   $contents     

[ Top ]

useLocalCache   [line 171]

void useLocalCache( $url, [ $cacheid = null])


Parameters:

   $url     
   $cacheid     

[ Top ]


Documentation generated on Wed, 06 Jul 2011 23:31:17 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.