Sets whether to automatically follow redirects or not.
public followRedirects ( boolean $followRedirect = true ) | ||
$followRedirect | boolean | Whether to follow redirects |
/** * @param $result * @return mixed */ protected function redirectIfNecessary($result, $maxRedirects, $redirectCount) { $locationHeader = $this->client->getInternalResponse()->getHeader('Location'); if ($locationHeader) { if ($redirectCount == $maxRedirects) { throw new \LogicException(sprintf('The maximum number (%d) of redirections was reached.', $maxRedirects)); } $this->debugSection('Redirecting to', $locationHeader); $result = $this->client->followRedirect(); $this->debugResponse($locationHeader); return $this->redirectIfNecessary($result, $maxRedirects, $redirectCount + 1); } $this->client->followRedirects(true); return $result; }
/** * Enables automatic redirects to be followed by the client */ public function startFollowingRedirects() { $this->client->followRedirects(true); }