Provides instancing and constants for the transport mechanisms. A transport is a mechanism for relaying data or for performing remote actions within an application. Primarily this is for making HTTP requests in a controlled manner through a defined interface but it can be used to send emails, contact other applications etc. Additional agents can be implemented for additional services not provided by the basic clients.
transportManager requires the agent type and the credentials object.
Example usage, connect to www.example.com to a CGI script and post some encoded vars:
$oCredentials = new transportCredentials();
$oCredentials->setParam(
array(
transportCredentials::PARAM_PROTOCOL => 'http',
transportCredentials::PARAM_HOST => 'www.example.com',
transportCredentials::PARAM_PORT => '8080',
transportCredentials::PARAM_PATH => '/server/side/path.cgi',
transportCredentials::PARAM_HTTP_TIMEOUT => 60,
transportCredentials::PARAM_HTTP_PERSISTENT_TIMEOUT => 60,
transportCredentials::PARAM_HTTP_METHOD => 'post',
transportCredentials::PARAM_MESSAGE_BODY => 'encode_post_vars',
), null
);
$oTransport = transportManager::getInstance(
transportManager::TRANSPORT_AGENT_HTTP,
$oCredentials
);
if ( $oTransport->send() ) {
// sent successfully
}
public static getAvailableTransports()
Returns array of available transports
public static addTransport($inTransport)
Add a new transport to the list of allowed transports (class name only)
public static removeTransport($inTransport)
Removes a new transport from the list of allowed transports (class name only)
public static isValidTransport($inTransport)
Returns true if $inTransport is a valid transport
public static getInstance($inTransport, $oCredentials)
Returns an instance of the transport
Posted by: Scorpio Documentor (Writer), in Transport on 19 Nov 2009 @ 20:39
Tags: transport, transportmanager,
This
work is licenced under a
Creative Commons Licence.