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

Class: PEAR_REST

Source Location: /PEAR-1.10.0dev2/PEAR/REST.php

Class Overview


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


Author(s):

Version:

  • Release: 1.10.0dev2

Copyright:

  • 1997-2009 The Authors

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

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

as well



[ Top ]


Class Variables

$config =

[line 36]


Type:   mixed


[ Top ]



Method Detail

__construct (Constructor)   [line 39]

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


Parameters:

   &$config   — 
   $options   — 

[ Top ]

downloadHttp   [line 338]

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 206]

void getCache( $url)


Parameters:

   $url   — 

[ Top ]

getCacheId   [line 193]

void getCacheId( $url)


Parameters:

   $url   — 

[ Top ]

retrieveCacheFirst   [line 56]

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 76]

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 225]

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 273]

void saveCacheFile( $file, $contents)


Parameters:

   $file   — 
   $contents   — 

[ Top ]

useLocalCache   [line 172]

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


Parameters:

   $url   — 
   $cacheid   — 

[ Top ]


Documentation generated on Fri, 31 Jul 2015 09:30:25 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.