I use the following code on the site:

curl_setopt($options,CURLOPT_URL,$_url); global $proxy; curl_setopt($options, CURLOPT_PROXY, $proxy); global $curlopt_useragent; curl_setopt($options,CURLOPT_USERAGENT,$curlopt_useragent); curl_setopt($options, CURLOPT_COOKIE, $cookie); curl_setopt($options, CURLOPT_COOKIEFILE, "file/cookie.txt"); curl_setopt($options, CURLOPT_COOKIEJAR, "file/cookie.txt"); curl_setopt($options,CURLOPT_TIMEOUT,60); curl_setopt($options,CURLOPT_MAXCONNECTS,1); curl_setopt($options,CURLOPT_AUTOREFERER,1); curl_setopt($options,CURLOPT_SSL_VERIFYPEER,0); curl_setopt($options,CURLOPT_SSL_VERIFYHOST,0); $loops=1; $loops_max=20; curl_setopt($options,CURLOPT_HEADER,1); curl_setopt($options,CURLOPT_RETURNTRANSFER,1); 

$proxy connected one by one, which is not very convenient. How can you change the code so that the proxies are accidentally taken via a url link (ie, 1/10/241/7/16 in an account) or were accidentally taken from a text file

    1 answer 1

    Well, as an option:

     $proxies = file_get_contents('proxies.txt'); //тут можно и урл написать, вместо имени файла $proxies_array = array_values(array_unique(explode("\n", str_replace("\r", "", $proxies)))); $proxy = $proxies_array[rand(0, count($proxies_array))]; 
    • file already divides by line breaks. Just trim for everyone. - user207618