Skip to main content

Proxy set up using CURL, PHP, .NET with C# or Python

Different ways to test and connect to SOAX proxies

Kate avatar
Written by Kate
Updated over 10 months ago

In this article, you will learn about the simplest ways to start testing or using SOAX proxies without browser extensions. The article provides the following testing methods:

  1. CURL for different OS;

  2. PHP;

  3. .NET Framework using C# (with Rebex HTTP library);

  4. Python.

Please note that "0YFEkZzfrwBX4Wfp" is a test login, which cannot be used in real-life scenarios. You must use your login instead. Also, note that "wifi;pl;" is a test password that sets up the target region. For successful testing, your IP must be tied to the checked packet.

1.CURL

in Linux:

launch Terminal/Bash and execute the request:

$ curl -x "http://0YFEkZzfrwBX4Wfp:wifi;pl;@proxy.soax.com:9000" -L http://checker.soax.com/api/ipinfo 

A successfully completed request looks like this:

$ curl -x "http://0YFEkZzfrwBX4Wfp:wifi;pl;@proxy.soax.com:9000" -L http://checker.soax.com/api/ipinfo {"status":true,"reason":"","data":{"status":true,"reason":"","data":{"carrier":"","city":"Wroclaw","country_code":"PL","country_name":"Poland","ip":"188.47.123.31","isp":"Orange Swiatlowod","region":"Lower Silesia"}}

in MacOS:

launch Terminal and execute the request:

curl -x "http://0YFEkZzfrwBX4Wfp:wifi;pl;@proxy.soax.com:9000" -L http://checker.soax.com/api/ipinfo

A successfully completed request looks like this:

macbook-username:~ username$ curl -x “http://0YFEkZzfrwBX4Wfp:wifi;pl;@proxy.soax.com:9000” -L http://checker.soax.com/api/ipinfo{“status”:true,“reason”:“”,“data”:{"status":true,"reason":"","data":{"carrier":"","city":"Wroclaw","country_code":"PL","country_name":"Poland","ip":"188.47.123.31","isp":"Orange Swiatlowod","region":"Lower Silesia"}} 

in Windows 10:

1) type "control" in the search box and open Control Panel:

2) select "Programs and Features":

3) select "Turn Windows features on or off":

4) mark the "Windows Subsystem for Linux" checkbox:

5) now, you can use "CURL" by running cmd.exe. The command should look like this:

curl -x http://0YFEkZzfrwBX4Wfp:wifi;pl;@proxy.soax.com:9000 -L http://checker.soax.com/api/ipinfo 

The executed command looks like this:

C:\>curl -x http://0YFEkZzfrwBX4Wfp:wifi;pl;@proxy.soax.com:9000 -L http://checker.soax.com/api/ipinfo 
{"status":true,"reason":"","data":{"status":true,"reason":"","data":{"carrier":"","city":"Wroclaw","country_code":"PL","country_name":"Poland","ip":"188.47.123.31","isp":"Orange Swiatlowod","region":"Lower Silesia"}}

in previous Windows versions:

1) install CURL using one of the methods below:

2) run cmd.exe and execute the command:

curl -x http://0YFEkZzfrwBX4Wfp:wifi;pl;@proxy.soax.com:9000 -L https://checker.soax.com/api/ipinfo

The executed command looks like this:

C:\cygwin64\bin>curl -x http://0YFEkZzfrwBX4Wfp:wifi;pl;@proxy.soax.com:9000 -L https://checker.soax.com/api/ipinfo
{"status":true,"reason":"","data":{"carrier":"","city":"Wroclaw","country_code":"PL","country_name":"Poland","ip":"188.47.123.31","isp":"Orange Swiatlowod","region":"Lower Silesia"}}

2. PHP

<?php
$auth = base64_encode('0YFEkZzfrwBX4Wfp:wifi;pl;');
$aContext = array(
'http' => array(
'proxy' => 'tcp://proxy.soax.com:9000',
'request_fulluri' => true,
'header' => "Proxy-Authorization: Basic $auth",
),
);
$cxContext = stream_context_create($aContext);
$sFile = file_get_contents("http://checker.soax.com/api/ipinfo", False, $cxContext);
echo $sFile, "\n";
?>

Code execution example (tested on Ubuntu 18.04.3 LTS with PHP 5.6):

$ php proxy_test.php

{"status":true,"reason":"","data":{"carrier":"","city":"Wroclaw","country_code":"PL","country_name":"Poland","ip":"188.47.123.31","isp":"Orange Swiatlowod","region":"Lower Silesia"}}

3. .NET Framework using C# (with Rebex HTTP library)

using Rebex.Net;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Rebex.Licensing.Key = "ENTER YOUR LICENSING KEY HERE";

var client = new Rebex.Net.HttpRequestCreator();

client.Proxy.ProxyType = ProxyType.Socks5;
client.Proxy.Host = "proxy.soax.com";
client.Proxy.Port = 9000;
client.Proxy.UserName = "0YFEkZzfrwBX4Wfp";
client.Proxy.Password = "wifi;us;;;";

var url = "http://checker.soax.com/api/ipinfo";

var httpRequest = client.Create(url);
httpRequest.Headers["Accept"] = "text/html, application/xhtml+xml, image/jxr, */*";
httpRequest.Headers["Accept-Language"] = "en-US,en;q=0.7,ru;q=0.3";
httpRequest.Headers["Accept-Encoding"] = "gzip, deflate";
httpRequest.Headers["Host"] = url;
httpRequest.Headers["Connection"] = "Keep-Alive";
httpRequest.Timeout = 30000;

try
{
var response = httpRequest.GetResponse() as Rebex.Net.HttpResponse;

using (StreamReader sr = new StreamReader(response.GetResponseStream()))
{
var content = sr.ReadToEnd();
Console.WriteLine("Url: " + url + " \n" + "Content length: " + content.Length + "\n" + "Response: \n" + content);
}
}
catch (Exception e)
{
Console.WriteLine("Url " + url + " is failed. \n" + e.Message);
}
Console.ReadKey();
}
}
}

4. Python

Python version 2.7 or 3.6 (using Requests library):

import requests as req

proxy = {
"http": "http://0YFEkZzfrwBX4Wfp:wifi;pl;@proxy.soax.com:9000",
"https": "http://0YFEkZzfrwBX4Wfp:wifi;pl;@proxy.soax.com:9000"
}

resp = req.get("http://checker.soax.com/api/ipinfo",proxies=proxy)

print(resp.text)

Code execution example on version 2.7 and 3.6, respectively (tested on Ubuntu 18.04.3 LTS):

$ python2.7 proxy_test.py

{"status":true,"reason":"","data":{"carrier":"","city":"Wroclaw","country_code":"PL","country_name":"Poland","ip":"188.47.123.31","isp":"Orange Swiatlowod","region":"Lower Silesia"}}

$ python3.6 proxy_test.py

{"status":true,"reason":"","data":{"carrier":"","city":"Wroclaw","country_code":"PL","country_name":"Poland","ip":"188.47.123.31","isp":"Orange Swiatlowod","region":"Lower Silesia"}}

Did this answer your question?