HPCloud-PHP  1.2.0
PHP bindings for HPCloud and OpenStack services.
 All Classes Namespaces Files Functions Variables Pages
Transporter Interface Reference

Describes a Transporter. More...

Inheritance diagram for Transporter:
CURLTransport PHPStreamTransport

Public Member Functions

 doRequest ($uri, $method= 'GET', $headers=array(), $body= '')
 Perform a request.
 doRequestWithResource ($uri, $method, $headers, $resource)
 Perform a request, but use a resource to read the body.

Public Attributes

const HTTP_USER_AGENT = 'HPCloud-PHP/1.0'

Detailed Description

Describes a Transporter.

Transporters are responsible for moving data from the remote cloud to the local host. Transporters are responsible only for the transport protocol, not for the payloads.

The current OpenStack services implementation is oriented toward REST-based services, and consequently the transport layers are HTTP/HTTPS, and perhaps SPDY some day. The interface reflects this. it is not designed as a protocol-neutral transport layer

Definition at line 41 of file Transporter.php.

Member Function Documentation

doRequest (   $uri,
  $method = 'GET',
  $headers = array(),
  $body = '' 
)

Perform a request.

Invoking this method causes a single request to be relayed over the transporter. The transporter MUST be capable of handling multiple invocations of a doRequest() call.

Parameters
string$uriThe target URI.
string$methodThe method to be sent.
array$headersAn array of name/value header pairs.
string$bodyThe string containing the request body.

Implemented in CURLTransport, and PHPStreamTransport.

doRequestWithResource (   $uri,
  $method,
  $headers,
  $resource 
)

Perform a request, but use a resource to read the body.

This is a special version of the doRequest() function. It handles a very spefic case where...

  • The HTTP verb requires a body (viz. PUT, POST)
  • The body is in a resource, not a string

Examples of appropriate cases for this variant:

  • Uploading large files.
  • Streaming data out of a stream and into an HTTP request.
  • Minimizing memory usage ($content strings are big).

Note that all parameters are required.

Parameters
string$uriThe target URI.
string$methodThe method to be sent.
array$headersAn array of name/value header pairs.
mixed$resourceThe string with a file path or a stream URL; or a file object resource. If it is a string, then it will be opened with the default context. So if you need a special context, you should open the file elsewhere and pass the resource in here.

Implemented in PHPStreamTransport, and CURLTransport.

Member Data Documentation

const HTTP_USER_AGENT = 'HPCloud-PHP/1.0'

Definition at line 43 of file Transporter.php.


The documentation for this interface was generated from the following file: