* require_once 'HTTP/Request2.php'; * require_once 'HTTP/Request2/Observer/Log.php'; * * $request = new HTTP_Request2('http://www.example.com'); * $observer = new HTTP_Request2_Observer_Log(); * $request->attach($observer); * $request->send(); *
* require_once 'HTTP/Request2.php'; * require_once 'HTTP/Request2/Observer/Log.php'; * require_once 'Log.php'; * * $request = new HTTP_Request2('http://www.example.com'); * // we want to log with PEAR log * $observer = new HTTP_Request2_Observer_Log(Log::factory('console')); * * // we only want to log received headers * $observer->events = array('receivedHeaders'); * * $request->attach($observer); * $request->send(); *