PHP code example of semperton / proxy

1. Go to this page and download the library: Download semperton/proxy 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/ */

    

semperton / proxy example snippets


use HttpSoft\Message\ResponseFactory;
use Semperton\Proxy\Client;

$client new Client(
	new ResponseFactory(), // any PSR-17 compilant response factory
	5, // request timeout in secs
	$options, // array of stream context options
	4096 // buffer size used to read/write request body
);

use HttpSoft\Message\RequestFactory;
use Psr\Http\Message\ResponseInterface;

$requestFactory = new RequestFactory();
$request = $requestFactory->createRequest('GET', 'https://google.com');

$response = $client->sendRequest($request);

$response instanceof ResponseInterface // true