Re: HTTP_Request not following redirects

From: Date: Sun, 03 Dec 2006 19:00:15 +0000
Subject: Re: HTTP_Request not following redirects
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-25965@lists.php.net to get a copy of this message
On Sun, Dec 03, 2006 at 08:58:54PM +0300, Alexey Borzov wrote: > Hi, > > diro@nixsys.bz wrote: > >Here's the sample code: > > > ><?php > > > > include ('HTTP/Request.php'); > > > > $req = &new > >HTTP_Request('http://www.$SITE.com/cgistuff.cgi', > > array('allowRedirects'=>true)); > > > > $req->setMethod(HTTP_REQUEST_METHOD_POST); > > > > $req->addPostData('var1', 'arg1'); > > > > $req->addPostData('var2', 'arg2'); > > > > $req->addPostData('var3', 'arg3'); > > > > $req->sendRequest();$response1 = $req->getResponseBody(); > > > > echo $response1; > > > >?> > > > >Now, i know it's POSTing correctly, because of the address returned in the > >headers. I can see via getResponseCode that it's 302, obviously not > >redirecting > >for some reason. > > > >Any ideas? Need more info? > > Redirect support in HTTP_Request is switched off by default for a reason. > That reason being that it wasn't touched for quite a bit of time and is > deprecated. What was it replaced by? I got the results i wanted by calling new HTTP_Request with an empty URL and allowRedirects and then using setURL to supply the query string.

« previous php.pear.general (#25965) next »