You are here

function HTTP_Request::attach in Flickr API 5

Adds a Listener to the list of listeners that are notified of the object's events

Events sent by HTTP_Request object

  • 'connect': on connection to server
  • 'sentRequest': after the request was sent
  • 'disconnect': on disconnection from server

Events sent by HTTP_Response object

  • 'gotHeaders': after receiving response headers (headers are passed in $data)
  • 'tick': on receiving a part of response body (the part is passed in $data)
  • 'gzTick': on receiving a gzip-encoded part of response body (ditto)
  • 'gotBody': after receiving the response body (passes the decoded body in $data if it was gzipped)

@access public

Parameters

HTTP_Request_Listener listener to attach:

Return value

boolean whether the listener was successfully attached

File

phpFlickr/PEAR/HTTP/Request.php, line 1046

Class

HTTP_Request
Class for performing HTTP requests

Code

function attach(&$listener) {
  if (!is_a($listener, 'HTTP_Request_Listener')) {
    return false;
  }
  $this->_listeners[$listener
    ->getId()] =& $listener;
  return true;
}