RE: [PEAR-DEV] HTTP_Request patch for Multiple requests support

From: Date: Sun, 29 Sep 2002 13:50:39 +0000
Subject: RE: [PEAR-DEV] HTTP_Request patch for Multiple requests support
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-9680@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 Nice idea, though wouldn't it be better as a wrapper class? Something like (eg) HTTP_Client, which is a composite of multiple HTTP_Requests. $foo = new HTTP_Client(); $foo->makeRequest('http://foo.com/login.php?user=myname&pass=mypass'); $response2 = $foo->makeRequest('http://foo.com/private.php'); Would need some other functions to enable you to manipulate a request before making it. This model would probably make it cleaner to handle cookies and when to send them to subsequent requests. -- Richard Heyes V-webmail - http://www.v-webmail.co.uk

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