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

Class: PEAR_REST

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

Class Overview


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


Author(s):

Version:

  • Release: 1.6.2

Copyright:

  • 1997-2006 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

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

as well



[ Top ]


Class Variables

$config =

[line 43]


Type:   mixed


[ Top ]



Method Detail

PEAR_REST (Constructor)   [line 45]

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


Parameters:

   &$config   — 
   $options   — 

[ Top ]

downloadHttp   [line 269]

string|array downloadHttp( string $url, [false|string|array $lastmodified = null], [false|array $accept = 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

[ Top ]

getCache   [line 180]

void getCache( $url)


Parameters:

   $url   — 

[ Top ]

getCacheId   [line 168]

void getCacheId( $url)


Parameters:

   $url   — 

[ Top ]

retrieveCacheFirst   [line 62]

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

[ Top ]

retrieveData   [line 80]

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

[ Top ]

saveCache   [line 198]

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 ]

useLocalCache   [line 149]

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


Parameters:

   $url   — 
   $cacheid   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:09:37 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.