HTTP_Request patch for Multiple requests support

From: Date: Sun, 29 Sep 2002 12:42:50 +0000
Subject: HTTP_Request patch for Multiple requests support
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-9676@lists.php.net to get a copy of this message
Hi Coming with another patch to HTTP_Request to add support for multiple requests: - preserves the current API - externalize the constructor into a setRequest() method, for multiple calls - reset _postData attribute, but not other attributes, in order to reuse them in next calls (this way, you don't have to set again proxy or auth settings for each call) - added a _cookies attribute to store cookies accross successive calls - modified sendRequest() method, to add all stored cookies to the request headers before sending the request, and then store cookies returned in the response headers, to be able to resend them in the next call a short example will demonstrate the benefits of this feature: the goal is to get a page from a site which requires authenticated session ... $a = &new HTTP_Request('http://www.somesite.come/login.php?username=myname&password=mypass'); $a->sendRequest(); $a->setRequest('http://www.somesite.com/private.php'); $a->sendRequest(); echo $a->getResponseBody(); this way, you can create a session with the first call, and then make successive calls in the same session, without having to retrieve cookies or set proxy settings every time ...

« previous php.pear.dev (#9676) next »