Proxy to access Webservice

Asked

Viewed 188 times

0

I feed a database with picking up data from a webservice

function pegarWS($produto){

$PRODUTO_WS = 'http://webservice.com/s/produto/';
$URL = $PRODUTO_WS.$produto;

It accesses the URL http://webservice.com/s/produto/ with the product name ($product) at the end.

This webservice is free and has a request limit.

I would like to go through a proxy (proxy.txt) with proxy ips.

Someone can help me?

1 answer

0


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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.