Php скрипт проверки прокси

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Check if a proxy is working, its type (transparent, anonymous, elite) and other info (time, http code, redirect count, speed etc.)

AlexeyFreelancer/ProxyChecker

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Fix ip and port prototype in one-proxy example.

Git stats

Files

Failed to load latest commit information.

README.md

Check if a proxy is working, its type (transparent, anonymous, elite) and other info (time, http code, redirect count, speed etc.)

type — http, socks4, socks5
password and type if not required

123:456:789:8080 123:456:789:8080,user:pass 123:456:789:8080,user:pass,socks5 
$pingUrl = 'http://yourdomain.com/ProxyChecker/ping.php'; $proxy = 'xxx.xxx.xxx.xxx:xx'; $proxyChecker = new ProxyChecker($pingUrl); $results = $proxyChecker->checkProxy($proxy); 
$pingUrl = 'http://yourdomain.com/ProxyChecker/ping.php'; $proxies = array('xxx.xxx.xxx.xxx:xx', 'xxx.xxx.xxx.xxx:xx'); $proxyChecker = new ProxyChecker($pingUrl); $results = $proxyChecker->checkProxies($proxies); 

Array allowed/disallowed operations of proxy (get, post, referer, cookie, user_agent), for example:

'allowed' => array ( 0 => 'get', 1 => 'post', 2 => 'referer', 3 => 'user_agent' ) 'disallowed' => array ( 0 => 'cookie' ) 

elite — connection looks like a regular client
anonymous — no ip is forworded but target site could still tell it’s a proxy
transparent — ip is forworded and target site would be able to tell it’s a proxy

Other proxy info — time, http code, redirect count, speed etc:

'info' => array ( 'content_type' => 'text/html', 'http_code' => 200, 'header_size' => 237, 'request_size' => 351, 'ssl_verify_result' => 0, 'redirect_count' => 0, 'total_time' => 1.212548, 'connect_time' => 0.058647, 'size_upload' => 143, 'size_download' => 485, 'speed_download' => 399, 'speed_upload' => 117, 'download_content_length' => 485, 'upload_content_length' => 143, 'starttransfer_time' => 1.059746, 'redirect_time' => 0, 'certinfo' => array (), ), 

About

Check if a proxy is working, its type (transparent, anonymous, elite) and other info (time, http code, redirect count, speed etc.)

Читайте также:  Генерация pdf средствами php

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Fast Proxy Checker in PHP

samuel-allan/FastProxyChecker

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Fast Proxy Checker Script

(Announcement): I am planning on releasing V1.3/V2.0 fairly soon, so if you have any thoughts on features feel free to send them to me or post them here

The current latest and most feature-rich version is 1.2, although you are free to use version 1.1 if you don’t need the new features.

So, currently there are two ways to check proxies:

  • Check a specific proxy (IP:PORT)
  • Check a big list of proxies simultaneously (multi-threaded approach)

Before you start using the code, you will have to grab a copy of the latest release, available here. Also note that this documentation is only related to the latest release, for other docs visit our page

Checking a specific proxy

Locate the checker.php script, and GET it with the parameters ip, port and timeout:

checker.php?ip=137.116.76.252&port=3128&timeout=20 

This code will check the proxy 137.116.76.252:3128 with a timeout of 20 seconds.

Results are returned in JSON format:

< "result": < "success": true, "proxy": < "ip": "137.116.76.252", "port": "3128", "speed": 339 > > >

And in the case of faliure you will get the reason why it failed (curl_error direct return):

< "result":< "success":false, "error":"Operation timed out after 1000 milliseconds with 0 bytes received", "proxy":< "ip":"186.227.185.123", "port":"80" > > >

If you are using version 1.2 you will also be able to check SOCKS4/5 proxies. In version 1.2 the proxy is checked for SOCKS by default after it has partially failed a check for HTTP (Connection reset error), however knowing for sure whether it is a SOCKS proxy you are about to check or no can minimise the time it will take to process.

Читайте также:  Make an email html

To check the proxy for SOCKS only use the proxy_type GET parameter:

localhost/checker.php?ip=201.173.168.52&port=10000&timeout=20&proxy_type=socks 

Checking a big list of proxies with multi-threading enabled

Unless the list of proxies you want to check is really small, you’ll want to use multi-threading which can speed up requests exponentially.

This feature works best if you supply a file with a list of proxies in it (Most free proxy listing websites will allow you to export proxies in IP:PORT format).

To check a list of proxies contained in file abc.txt with a timeout of 20 seconds:

localhost/checker.php?file=abc.txt&timeout=20 

This uses multi-threading and hence instead of taking 200 seconds for 10 proxies (20 secs timeout * 10 proxies), it will take roughly 30 seconds to finish.

However, the results are going to be a bit different this time, because you’ve checked a big list of proxies instead of one:

< "results":[ < "success":true, "proxy":< "ip":"186.227.185.123", "port":"80", "speed":2300 > >, < "success":true, "proxy":< "ip":"186.227.56.162", "port":"80", "speed":623 > >, < "success":true, "proxy":< "ip":"221.212.74.203", "port":"63163", "speed":907 > >, < "success":true, "proxy":< "ip":"180.166.112.47", "port":"8888", "speed":1468 > >, < "success":true, "proxy":< "ip":"221.212.74.203", "port":"12", "speed":802 > >, < "success":true, "proxy":< "ip":"221.212.74.204", "port":"12", "speed":779 > >, < "success":true, "proxy":< "ip":"221.212.74.204", "port":"19452", "speed":803 > >, < "success":true, "proxy":< "ip":"219.237.16.38", "port":"80", "speed":12909 > >, < "success":true, "proxy":< "ip":"221.212.74.204", "port":"933", "speed":874 > >, < "success":true, "proxy":< "ip":"131.0.168.86", "port":"80", "speed":8802 > > ] >

As you can see from the json, it has an array of ‘results’ with results for each and every proxy in the list.

SOCKS Proxy support in big lists Only in Version 1.2

Same principal applies to big lists (multi-threaded checking).

Version 1.3 (Estimated release date : Unknown)

  • Will have a version supporting includes (as a library)
  • Finally adding proxy annonimity tests
  • Adding multi-threading without the need for file includes (GET arrays)
  • Possibly support for other file formats

Changelogs for currently active versions

Version 1.2 NEW (Fixes & Updates to Version 1.1)

  • Now supporting SOCKS4/5 proxies!
  • Added proxy type field in outputted JSON
  • All proxy checking scripts have been updated, and some bugs have been fixed

Version 1.1 (Updated from Version 1.0)

  • Dropped command-line support, now using a browser-approach (GET Requests)
  • Switched to stable and working methods (100% accurate proxy checks)
  • Increased speed and multi-threading ability
  • Added support for checking single proxies individually
  • You can now specify a custom timeout
Version number Working Bug Rating Documentation
Version 1.2 Yes Stable V1.2 Release
Version 1.1 Yes Stable V1.1 Branch
Version 1.0 N/A No Support V1.0 Outdated

Me (Samuel Allan) for creating and maintaining the code.

W. Al Maawali for the script that V1.1 was built on.

Miyachung for creating the script that V1.0 was wrapped around.

You can contact Miyachung at Miyachung@hotmail.com

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Читайте также:  Рухомий рядок

Proxy Checker is a PHP library that allows you to quickly check a list of proxies.

License

retrowaver/php-proxy-checker

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Proxy Checker is a PHP library that allows you to quickly check a list of proxies.

  • fast (thanks to asynchronous requests)
  • simple (PSR-7 based)
  • supports many protocols
  • customizable (full control over request / response checking)
composer require retrowaver/proxy-checker 

ProxyChecker constructor takes 2 mandatory arguments:

When checkProxies() is called, it attempts to send that request using every proxy, and then calls checkResponse() of provided ResponseCheckerInterface implementation, which ultimately decides whether proxy is valid or not.

Depending on how much control you want, you can use built-in ResponseCheckerBuilder for a quick start (see below) or make a custom class.

Make proxy array manually:

use Retrowaver\ProxyChecker\Entity\Proxy; $proxies = [ (new Proxy) ->setIp('127.0.0.1') ->setPort(1080) ->setProtocol('http'), (new Proxy) ->setIp('192.168.1.1') ->setPort(8080) ->setProtocol('http') ];

. or use built-in simple importer:

use Retrowaver\ProxyChecker\Import\SimpleImporter; $importer = new SimpleImporter; $lines = file('path-to-file-with-proxies.txt'); // ip:port format $proxies = $importer->import($lines, 'http');

Prepare a PSR-7 request that will be send using proxies.

use GuzzleHttp\Psr7\Request; $request = new Request('GET', 'http://example.com');

Step 3. Prepare ResponseChecker

You can use built-in ResponseCheckerBuilder:

use Retrowaver\ProxyChecker\ResponseChecker\ResponseCheckerBuilder; $responseChecker = (new ResponseCheckerBuilder) ->bodyContains('some string on target website') ;

or write a custom ResponseCheckerInterface implementation:

use Psr\Http\Message\ResponseInterface; use Retrowaver\ProxyChecker\Entity\ProxyInterface; class CustomResponseChecker implements ResponseCheckerInterface < public function checkResponse( ResponseInterface $response, ProxyInterface $proxy ): bool < if (...) < // proxy not valid return false; > // valid proxy return true; > >
$responseChecker = new CustomResponseChecker;

Step 4. Create ProxyChecker and check proxies

use Retrowaver\ProxyChecker\ProxyChecker; $proxyChecker = new ProxyChecker($request, $responseChecker); $validProxies = $proxyChecker->checkProxies($proxies);

ProxyChecker accepts optional parameters $options and $requestOptions :

PHP Proxy Checker should work with http, https, socks4, socks4a, socks5 and socks5h proxies (see https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html for descriptions).

About

Proxy Checker is a PHP library that allows you to quickly check a list of proxies.

Источник

Оцените статью