Я пытаюсь использовать прокси socks из https://proxy6.net,, где я получаю IP, порт, а также данные, такие как имя пользователя и пароль. Проблема в curl на php, я использовал код Как использовать CURL через прокси-сервер? , и настроить мою учетную запись и прокси. Примерно так:
$proxy = 'ip:port';
$proxyauth = 'user:pass';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); // URL for CURL call
curl_setopt($ch, CURLOPT_PROXY, $proxy); // PROXY details with port
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth); // Use if proxy have username and password
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); // If expected to call with specific PROXY type
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // If url has redirects then go to the final redirected URL.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Do not outputting it out directly on screen.
curl_setopt($ch, CURLOPT_HEADER, 1); // If you want Header information of response else make 0
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
echo $curl_scraped_page;
но код ничего не отображает. Даже если я попытаюсь использовать обычный curl (без прокси), он отобразит мой ip.
. Я использую PHP 7.3.9 на своем компьютере. Что-то не так с кодом?