note 90016 deleted from httprequest.send by sobak
| From: | sobak@php.net | Date: | Sun, 04 Dec 2016 07:27:09 +0000 |
| Subject: | note 90016 deleted from httprequest.send by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208114@lists.php.net to get a copy of this message | ||
Note Submitter: mjs at beebo dot org
----
Note that send() does not process redirects, and there doesn't appear to any way to get this to
happen automatically. If you need to follow redirects, use something like the following code:
<?php
$request = new HttpRequest($url, HTTP_METH_GET);
do {
$response = $request->send();
if ($response->getResponseCode() != 301 && $response->getResponseCode() != 302)
break;
$request->setUrl($response->getHeader("Location"));
} while (1);
?>