You can use the API of http://gimmeproxy.com/. It has the free version and the version.
The way to capture for both versions is the same thing and only changes one parameter in the URL.
To capture a proxy, simply make a request to https://gimmeproxy.com/api/getProxy
with some of the parameters below:
api_key=<your-key>
: Your key (if the paid version)
get=true
: For proxy with GET request support
post=true
: For proxy with POST request support
supportsHttps=true
: For proxy with HTTPS support
country:BR,US
: For proxy for certain countries. Separate by comma
minSpeed
: Minimum proxy Kbps speed
For more parameters, visit the site above.
To capture in PHP, just use the library cURL
or file_get_contetns
.
Example:
$proxy = json_decode( file_get_contents("https://gimmeproxy.com/api/getProxy") );
var_dump( $proxy );
With parameters
$proxy = json_decode( file_get_contents("https://gimmeproxy.com/api/getProxy?supportsHttp=true&get=true") );
var_dump( $proxy );
To save these proxy in a file txt
, just use file_put_contents
:
$proxy = file_get_contents("https://gimmeproxy.com/api/getProxy?supportsHttp=true&get=true");
file_put_contents( "ips.txt", print_r($proxy, true), FILE_APPEND )
└───┬───┘ └─────────┬──────────┘ └─────┬─────┘
│ │ └──────── Utilize esse parâmetro para não sobrescrever o arquivo.
│ └─────────────────────────── Conteúdo do arquivo
└──────────────────────────────────────────── Nome do arquivo