PHP code example of tanedaa / laravel-webshare

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

    

tanedaa / laravel-webshare example snippets


use Illuminate\Support\Facades\Schedule;

Schedule::command('webshare:update-proxies --page-size=100')->hourly();

$schedule->command('webshare:update-proxies --page-size=100')->hourly();

use Illuminate\Support\Facades\Http;

$response = Http::webshare()->get('https://api.ipify.org?format=json');

$response = Http::timeout(15)->webshare()->get('https://httpbin.org/ip');

use Tanedaa\LaravelWebShare\Facades\WebShare;

$proxyUrl = WebShare::getRandomProxyUrl();
$proxyData = WebShare::getRandomProxyData();
$proxyCredentials = WebShare::getRandomProxyCredentials();

[
    'proxy_id' => '...',
    'address' => 'host:port',
    'ip' => 'host',
    'port' => 1234,
    'is_valid' => true,
    'country_code' => '...',
    'city_name' => '...',
    'asn_name' => '...',
    'asn_number' => '...',
]

[
    'address' => 'host:port',
    'ip' => 'host',
    'port' => 1234,
    'username' => '...',
    'password' => '...',
    'proxy_url' => 'http://user:pass@host:port',
]

use Tanedaa\LaravelWebShare\Services\WebShare;

public function __invoke(WebShare $webShare)
{
    return $webShare->getRandomProxyData();
}
bash
php artisan vendor:publish --tag=webshare
bash
php artisan vendor:publish --tag=webshare-config
php artisan vendor:publish --tag=webshare-migrations
bash
php artisan migrate
bash
php artisan webshare:update-proxies
bash
php artisan webshare:update-proxies --page-size=200