M
M
Michael Compass2020-04-23 05:52:54
PHP
Michael Compass, 2020-04-23 05:52:54

What is the reason that my checker proxy does not check from the original list - socks5 proxy?

What is the reason that my proxy checker does not check from source file (gotovo_vse_sellery_bezdybley.txt) - proxy like "socks5" ?

Although in the source file (gotovo_vse_sellery_bezdybley.txt) working proxies like "socks5" - very good. lot.

And also, for some reason, the final result (proxyuniq.txt file) includes proxies of the "http" type, in an amount of approximately 25% of the total volume of the final list of proxies (proxyuniq.txt file), although the proxies of the "http" type in "final" should not be, there should be only proxy types: "http" and "socks5"

Code:

<?php
$proxies = file ("gotovo_vse_sellery_bezdybley.txt");
if (empty($proxies))
{
    exit(1);
}

$mc = curl_multi_init ();
for ($thread_no = 0; $thread_no<count ($proxies); $thread_no++)
{
    $c [$thread_no] = curl_init ();
    curl_setopt ($c [$thread_no], CURLOPT_URL, "http://google.com");
    curl_setopt ($c [$thread_no], CURLOPT_HEADER, 0);
    curl_setopt ($c [$thread_no], CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($c [$thread_no], CURLOPT_CONNECTTIMEOUT, 15);
    curl_setopt ($c [$thread_no], CURLOPT_TIMEOUT, 30);
    curl_setopt ($c [$thread_no], CURLOPT_PROXY, trim ($proxies [$thread_no]));
    curl_setopt ($c [$thread_no], CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
    curl_multi_add_handle ($mc, $c [$thread_no]);
}
 
$proxies_out = array();
do {
    while (($execrun = curl_multi_exec ($mc, $running)) == CURLM_CALL_MULTI_PERFORM);
    if ($execrun != CURLM_OK) break;
    while ($done = curl_multi_info_read ($mc))
    {
        $info = curl_getinfo ($done ['handle']);
        if ($info ['http_code'] == 301) {
            echo trim ($proxies [array_search ($done['handle'], $c)])."\r\n";
            $proxies_out[trim($proxies[array_search($done['handle'], $c)])] = trim($proxies[array_search($done['handle'], $c)]);
            unset($proxies[array_search ($done['handle'], $c)]);
        }
        curl_multi_remove_handle ($mc, $done ['handle']);
    }
} while ($running);
curl_multi_close ($mc);

$mc = curl_multi_init ();
for ($thread_no = 0; $thread_no<count ($proxies); $thread_no++)
{
    $c [$thread_no] = curl_init ();
    curl_setopt ($c [$thread_no], CURLOPT_URL, "http://google.com");
    curl_setopt ($c [$thread_no], CURLOPT_HEADER, 0);
    curl_setopt ($c [$thread_no], CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($c [$thread_no], CURLOPT_CONNECTTIMEOUT, 15);
    curl_setopt ($c [$thread_no], CURLOPT_TIMEOUT, 30);
    curl_setopt ($c [$thread_no], CURLOPT_PROXY, trim ($proxies [$thread_no]));
    curl_setopt ($c [$thread_no], CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME); 
    curl_multi_add_handle ($mc, $c [$thread_no]);
}
 
$proxies5_out = array();
do {
    while (($execrun = curl_multi_exec ($mc, $running)) == CURLM_CALL_MULTI_PERFORM);
    if ($execrun != CURLM_OK) break;
    while ($done = curl_multi_info_read ($mc))
    {
        $info = curl_getinfo ($done ['handle']);
        if ($info ['http_code'] == 301) {
            echo trim ($proxies [array_search ($done['handle'], $c)])."\r\n";
            $proxies5_out[trim($proxies[array_search($done['handle'], $c)])] = trim($proxies[array_search($done['handle'], $c)]);
        }
        curl_multi_remove_handle ($mc, $done ['handle']);
    }
} while ($running);
curl_multi_close ($mc);

file_put_contents("proxyuniq.txt", implode("\r\n", $proxies_out)."\r\n\r\n".implode("\r\n", $proxies5_out));
?>


This question is a logical continuation of this solved question . How to add checking and issuing SOCKS5 proxies to HTTPS and HTTP checks?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AUser0, 2020-04-23
@AUser0

Something this marathon looks like "Write me a script for my fantasies."
Here, take and carefully reread your condition: although there should not be a proxy like " http " in the "final", there should be only proxy types: " http " and "socks5".
In addition, I already answered in your last "task" that Google is good at blocking proxies, including ALL sock4 and sock5, well, they are at war with bots. And here again... Do you think a task repeated 10,000,000 times will still get access to Google through a proxy for 10,000,001 repetitions?!?!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question