how to use free ProxyScrape API

How to Use Free ProxyScrape API

Do you know how to use free ProxyScrape API? This article will give you the detailed guide.

This API is for our free proxy list and the results returned by it can be used anywhere free of charge.

Get proxy list

https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all
Sample codes,

C#

var client = new RestClient("https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all"); client.Timeout = -1; var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content);

CURL

curl --location --request GET 'https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all'

Dart – Http

var request = http.Request('GET', Uri.parse('https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all')); http.StreamedResponse response = await request.send(); if (response.statusCode == 200) { print(await response.stream.bytesToString()); } else { print(response.reasonPhrase); }

Go – Native

package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all" method := "GET" client := &http.Client { } req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return } res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) }

HTTP

GET /v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all HTTP/1.1 Host: api.proxyscrape.com

java okhttp

OkHttpClient client = new OkHttpClient().newBuilder() .build(); Request request = new Request.Builder() .url("https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all") .method("GET", null) .build(); Response response = client.newCall(request).execute();

JavaScript – Fetch

var requestOptions = { method: 'GET', redirect: 'follow' }; fetch("https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));

JavaScript – jQuery

var settings = { "url": "https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all", "method": "GET", "timeout": 0, }; $.ajax(settings).done(function (response) { console.log(response); });

JavaScript – XHR

 var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function() { if(this.readyState === 4) { console.log(this.responseText); } }); xhr.open("GET", "https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all"); xhr.send();

C – libcurl

CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all"); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https"); struct curl_slist *headers = NULL; curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); res = curl_easy_perform(curl); } curl_easy_cleanup(curl);

NodeJs – Axios

var axios = require('axios'); var config = { method: 'get', url: 'https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all', headers: { } }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); });

NodeJs – Native

var https = require('follow-redirects').https; var fs = require('fs'); var options = { 'method': 'GET', 'hostname': 'api.proxyscrape.com', 'path': '/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all', 'headers': { }, 'maxRedirects': 20 }; var req = https.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function (chunk) { var body = Buffer.concat(chunks); console.log(body.toString()); }); res.on("error", function (error) { console.error(error); }); }); req.end();

DNodeJs – Request

var request = require('request'); var options = { 'method': 'GET', 'url': 'https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all', 'headers': { } }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });

PHP – cURL

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', )); $response = curl_exec($curl); curl_close($curl); echo $response;

Python – http.client

import http.client conn = http.client.HTTPSConnection("api.proxyscrape.com") payload = '' headers = {} conn.request("GET", "/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Python – Requests

import requests url = "https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all" payload={} headers = {} response = requests.request("GET", url, headers=headers, data=payload) print(response.text)

Ruby – Net::HTTP

require "uri" require "net/http" url = URI("https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Get.new(url) response = https.request(request) puts response.read_body

Shell – Httpie

http --follow --timeout 3600 GET 'https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all'

Shell – get

wget --no-check-certificate --quiet \ --method GET \ --timeout=0 \ --header '' \ 'https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all'

 

Swift – URLSession

import Foundation #if canImport(FoundationNetworking) import FoundationNetworking #endif var semaphore = DispatchSemaphore (value: 0) var request = URLRequest(url: URL(string: "https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all")!,timeoutInterval: Double.infinity) request.httpMethod = "GET" let task = URLSession.shared.dataTask(with: request) { data, response, error in guard let data = data else { print(String(describing: error)) semaphore.signal() return } print(String(data: data, encoding: .utf8)!) semaphore.signal() } task.resume() semaphore.wait()
PARAMS
request displayproxies
Define whether the proxies should download or display in the browser. Possible values:

  • displayproxies: display the proxies in the browser
  • getproxies: download the proxies
protocol http
Protocol of the proxies that should be downloaded. Possible values:

  • http
  • socks4
  • socks5
  • all

If you want to download two protocols at once, the values can be separated by a comma, E.G., protocol=socks4,socks5
When this parameter is not defined, it will default to all.

timeout 10000
The maximum timeout of the proxies that should be downloaded in miliseconds.
country all
The country parameter can be any Alpha 2 ISO country code or ‘all'. When no country is defined the country will be automatically set to ‘all'. You can also use multiple countries in 1 request by separating them by a comma.
ssl all
Should the proxies support SSL (HTTPS)? This parameter is only for if you download HTTP proxies.
anonymity all
Define which anonymity level the proxies should have:

  • elite
  • anonymous
  • transparent
  • all

When no anonymity level is defined, it will default to ‘all'. You can also use multiple anonymity levels in 1 request by separating them by a comma.
This parameter only applies to HTTP(s) proxies.

Example Request:
var request = http.Request('GET', Uri.parse('https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}

Get proxy list details

https://api.proxyscrape.com/v2/?request=proxyinfo
This API endpoint will return information of the available proxies such as:
  • Amount of available proxies
  • Time since last proxy list update
  • Available countries
  • Organizations the proxies are related to
  • Ports of the proxies

This API end-point also supports all parameters described in “Get proxy list.”

PARAMS

request proxyinfo
simplified true
Use this parameter if you only want to receive the amount of available proxies.
Example Request
var request = http.Request('GET', Uri.parse('https://api.proxyscrape.com/v2/?request=proxyinfo'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}

References,


Disclaimer: This part of the content is mainly from the merchant. If the merchant does not want it to be displayed on my website, please contact us to delete your content.

Last Updated on December 12, 2023

Do you recommend the proxy service?

Click on a trophy to award it!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.

Leave a Comment

Your email address will not be published. Required fields are marked *

en_USEnglish
Scroll to Top