Proxy to access Webservice [closed]

0

I feed a database with taking data from a webservice

function pegarWS($produto){

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

It accesses the URL link with the product name ($ product) at the end.

This webservice is free and has a request limit.

I'd like to pass a proxy (proxy.txt) with proxy ips.

Can anyone help me?

    
asked by anonymous 22.02.2018 / 02:45

1 answer

0

You can use the link API. It has the free version and the version.

The way to capture for both versions is the same and only changes one parameter in the URL.

To capture a proxy, just make a request for https://gimmeproxy.com/api/getProxy with some of the parameters below:

  • api_key=<your-key> : Your key (if it is 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 speed in Kbps of proxy

For more parameters, go to the above website.

To make the 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 txt file, 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
    
22.02.2018 / 03:17