PHP code example of jpcaparas / laravel-http-socks5

1. Go to this page and download the library: Download jpcaparas/laravel-http-socks5 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/ */

    

jpcaparas / laravel-http-socks5 example snippets


'providers' => [
    // ...
    JPCaparas\Socks5Proxy\Socks5ProxyServiceProvider::class,
],

use Illuminate\Support\Facades\Http;

$response = Http::socks5()
    ->setHost('proxy.example.com')
    ->setPort(1080)
    ->setCredentials('username', 'password')
    ->get('http://example.com');

use Illuminate\Support\Facades\Http;

$client = Http::socks5()
    ->setHost('proxy.example.com')
    ->setCredentials('username', 'password')
    ->withOptions([
        'debug' => true,
        'timeout' => 30
    ]);

$response = $client->post('https://api.example.com/data', [
    'key' => 'value'
]);

use Illuminate\Support\Facades\Http;

$response = Http::socks5()
    ->setHost('proxy.example.com')
    ->setCredentials('username', 'password')
    ->withOptions(['debug' => true])
    ->get('http://example.com');

$client = \Illuminate\Support\Facades\Http::socks5()
   ->setHost('amsterdam.nl.socks.nordhold.net')
   ->setCredentials('username', 'password');

$client->withOptions(['debug' => true])->get('https://www.google.com');