Aug 4, 2022
0
Level 10
How to connect to socks5 proxy using Laravel?
Hi all,
I need to be able to connect through a socks 5 VPN through Laravel for data access to another companie's platform. Any idea how to change this below into a Guzzle friendly way? I have not used any of the 2 libraries in the past. I found this with Curl connection code:
$ch = curl_init();
// Simple temp service which returns your IP
$url = 'https://xxxxxxxxxxxxx.io/ip.php';
$proxy = 'socks5://127.0.0.1:12345';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$curl_scraped_page = curl_exec($ch);
echo $curl_scraped_page;
curl_close($ch);
Thanks!
Please or to participate in this conversation.