vantoozz / proxy-scraper

Library for scraping free proxies lists
MIT License
82 stars 17 forks source link

Implement method to get proxy protocol #4

Closed sleeyax closed 4 years ago

sleeyax commented 6 years ago

From the README file:

$scraper = new Scrapers\FreeProxyListScraper($httpClient);

foreach ($scraper->get() as $proxy) {
    echo (string)$proxy . "\n";
}

This will output ip:port. I think currently there is no way to get the proxy protocol (HTTP, HTTPS, SOCKS) too. If this is implemented, users can create filters like for example:

foreach ($scraper->get() as $proxy) {
    // Only show proxies with the HTTPS protocol
    if ($proxy->getProtocol() == "HTTPS") {
        echo (string)$proxy .  "\n";
    }
}

If the protocol can't be scraped (this is mostly the case with online .txt lists) maybe you can just return ANY or null when using $proxy->getProtocol().

vantoozz commented 6 years ago

Please clarify

sleeyax commented 6 years ago

Oh excuse me, I thought it was clear. I've edited my comment.