HTTP_Client::attach() – Adds a Listener to the list of listeners that are notified of the object's events


require_once 'HTTP/Client.php';

boolean HTTP_Client::attach ( object HTTP_Request_Listener &$listener , boolean $propagate = false )


The attached Listeners are notified of the following events:

sent before a HTTP request that is not a result of previous redirect.
sent upon receiving a successfull 2xx response (or 3xx response, if it is not a redirect or if redirect processing is disabled).
sent when a 3xx redirection response is received, before following a redirect
sent on 4xx, 5xx response

If $propagate is TRUE the Listener will be attached to the created HTTP_Request objects and will be notified of their events as well.


object HTTP_Request_Listener &$listener

Listener instance to attach

boolean $propagate

Whether the listener should be attached to the created HTTP_Request objects

Return value

returns whether the listener was successfully attached


throws no exceptions thrown


see detach()


This function can not be called statically.

Constructor (Previous) Returns the most recent HTTP response (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.