guzzle-proxy.php
<?php
use GuzzleHttp\Client;
require 'vendor/autoload.php';
$http_proxy = [
'http://124.133.230.254:80',
'http://111.13.111.184:80',
'http://58.220.95.107:80'
];
$clients = new SplQueue();
foreach ($http_proxy as $proxy) {
$config = [
'proxy' => ['http' => $proxy]
];
$clients->enqueue(new Client($config));
}
for ($i = 0; $i < 3; $i++) {
$client = $clients->dequeue();
$response = $client->get('http://ifconfig.me');
$ip = $response->getBody()->getContents();
echo $ip . PHP_EOL;
$clients->enqueue($client);
}