PHP code example of webclient / ext-redirect

1. Go to this page and download the library: Download webclient/ext-redirect library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webclient / ext-redirect example snippets




use Webclient\Extension\Redirect\RedirectClientDecorator;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestInterface;

/** 
 * @var ClientInterface $client Your PSR-18 HTTP Client
 * @var int $maxRedirects Max follow redirects
 */
$http = new RedirectClientDecorator($client, $maxRedirects);

/** @var RequestInterface $request */
$response = $http->sendRequest($request);