This will create new credentials for selected user on selected router and selected Proxy IP.
Name | Requirements | Options | |
---|---|---|---|
api_key | string|required | Get your api key from https://createproxy.com/dashboard/api | |
router_id | numeric|required | Get router_id for which you want to create new credentials by https://createproxy.com/api/router/get_router_list/ | |
category_id | numeric|required | Get existing category_id for which you want to create new credentials by https://createproxy.com/api/router/get_router_list/ or first add new category | |
port_number | numeric | In https://createproxy.com/api/router/get_router_list/ you may find port_from and port_to, so you may define port number you want to use, if not selected, CreateProxy will pick one port randomly for you | |
proxy_type | numeric|required | 1 => HTTP IPv4, 2 => SOCKS5 IPv4, 3 => HTTP IPv6 Please note that SOCKS5 at the time of writing this is not available! | |
proxy_id | numeric|required | This is ID of Proxy that is assigned to server that is assigned to router. This field is required and you can retrive proxy_id by https://createproxy.com/api/merchant/get_server_proxies/ API method | |
customer_auth | numeric|required | 1 => Auth by IP, 2 => Auth by Login, 3 => Without Auth | |
customer_id | numeric|required | Customer ID (user_id) may be retrived by https://createproxy.com/api/router/list_users/ API method | |
proxy_username | string | This apply only when customer_auth = 2, it is not required if empty default customer Proxy Username will be used | |
proxy_password | string | This apply only when customer_auth = 2, it is not required if empty default customer Proxy Password will be used | |
whitelist | string | This apply only when customer_auth = 1 - Insert allowed IP Addresses divided by comma, if empty default customer whitelist will be used | |
expiration | numeric | Leave empty or 0 to disable automatic expiration or insert number of days from now when this proxy will automatically expire. |
// Read more at https://createproxy.com/api/router/add_credentials/
// createproxy.class.php is available on GitHub: https://github.com/Coxii/CreateProxy
require_once "createproxy.class.php";
$client = new CreateProxyClient('REPLACE_WITH_YOUR_API_KEY');
$params = array();
$params['router_id'] = "845"; // Get router_id for which you want to create new credentials by https://createproxy.com/api/router/get_router_list/
$params['category_id'] = "985"; // Get existing category_id for which you want to create new credentials by https://createproxy.com/api/router/get_router_list/ or first add new category
$params['port_number'] = "3129"; // In https://createproxy.com/api/router/get_router_list/ you may find port_from and port_to, so you may define port number you want to use, if not selected, CreateProxy will pick one port randomly for you
$params['proxy_type'] = "1"; // 1 => HTTP IPv4, 2 => SOCKS5 IPv4, 3 => HTTP IPv6 Please note that SOCKS5 at the time of writing this is not available!
$params['proxy_id'] = "145"; // This is ID of Proxy that is assigned to server that is assigned to router. This field is required and you can retrive proxy_id by https://createproxy.com/api/merchant/get_server_proxies/ API method
$params['customer_auth'] = "1"; // 1 => Auth by IP, 2 => Auth by Login, 3 => Without Auth
$params['customer_id'] = "1"; // Customer ID (user_id) may be retrived by https://createproxy.com/api/router/list_users/ API method
$params['proxy_username'] = "TestProxyUsername"; // This apply only when customer_auth = 2, it is not required if empty default customer Proxy Username will be used
$params['proxy_password'] = "TestProxyPassword123"; // This apply only when customer_auth = 2, it is not required if empty default customer Proxy Password will be used
$params['whitelist'] = "111.222.333,444.555.666,777.888.999"; // This apply only when customer_auth = 1 - Insert allowed IP Addresses divided by comma, if empty default customer whitelist will be used
$params['expiration'] = "0"; // Leave empty or 0 to disable automatic expiration or insert number of days from now when this proxy will automatically expire.
try {
$request = $client->request('router','add_credentials',$params);
} catch(CreateProxyException $e) {
print_r($e->getMessage());
exit;
}
echo '<pre>';
print_r($request);
echo '</pre>';
// CreateProxy API end
<!-- Read more at https://createproxy.com/api/router/add_credentials/ -->
$api_url = "https://createproxy.com/api/request/router/add_credentials/";
$params = array();
$params['api_key'] = "REPLACE_WITH_YOUR_API_KEY"; // Get your api key from https://createproxy.com/dashboard/api
$params['router_id'] = "845"; // Get router_id for which you want to create new credentials by https://createproxy.com/api/router/get_router_list/
$params['category_id'] = "985"; // Get existing category_id for which you want to create new credentials by https://createproxy.com/api/router/get_router_list/ or first add new category
$params['port_number'] = "3129"; // In https://createproxy.com/api/router/get_router_list/ you may find port_from and port_to, so you may define port number you want to use, if not selected, CreateProxy will pick one port randomly for you
$params['proxy_type'] = "1"; // 1 => HTTP IPv4, 2 => SOCKS5 IPv4, 3 => HTTP IPv6 Please note that SOCKS5 at the time of writing this is not available!
$params['proxy_id'] = "145"; // This is ID of Proxy that is assigned to server that is assigned to router. This field is required and you can retrive proxy_id by https://createproxy.com/api/merchant/get_server_proxies/ API method
$params['customer_auth'] = "1"; // 1 => Auth by IP, 2 => Auth by Login, 3 => Without Auth
$params['customer_id'] = "1"; // Customer ID (user_id) may be retrived by https://createproxy.com/api/router/list_users/ API method
$params['proxy_username'] = "TestProxyUsername"; // This apply only when customer_auth = 2, it is not required if empty default customer Proxy Username will be used
$params['proxy_password'] = "TestProxyPassword123"; // This apply only when customer_auth = 2, it is not required if empty default customer Proxy Password will be used
$params['whitelist'] = "111.222.333,444.555.666,777.888.999"; // This apply only when customer_auth = 1 - Insert allowed IP Addresses divided by comma, if empty default customer whitelist will be used
$params['expiration'] = "0"; // Leave empty or 0 to disable automatic expiration or insert number of days from now when this proxy will automatically expire.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$api_url");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['SERVER_NAME']);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_ENCODING,"gzip,deflate");
$result=curl_exec($ch);
curl_close($ch);
if($result === false) {
die("Failed to perform request");
}
$response = json_decode($result, true);
if(!$response) {
die('CreateProxy responded with invalid response');
} else if(!isset($response['type'])) {
die('CreateProxy responded with incorrect status key');
} else if($response['type'] == 'error') {
if(isset($response['title']) AND isset($response['message'])) {
die($response['title']. ': ' . $response['message']);
} else if(isset($response['message'])){
die('API ERROR: ' . $response['message']);
} else {
die('API UNDEFINNED ERROR');
}
}
echo '<pre>';
print_r($response);
echo '</pre>';
<!-- CreateProxy API end -->
// read more at https://createproxy.com/api/router/add_credentials/
using System;
using System.Diagnostics;
using System.Net;
using System.IO;
class Program
{
static void Main(string[] args)
{
string api_key = "REPLACE_WITH_YOUR_API_KEY";
string router_id = "845";
string category_id = "985";
string port_number = "3129";
string proxy_type = "1";
string proxy_id = "145";
string customer_auth = "1";
string customer_id = "1";
string proxy_username = "TestProxyUsername";
string proxy_password = "TestProxyPassword123";
string whitelist = "111.222.333,444.555.666,777.888.999";
string expiration = "0";
string serviceUri = "https://createproxy.com/api/request/router/add_credentials/";
string post_data = "api_key=" + api_key + "router_id=" + router_id + "category_id=" + category_id + "port_number=" + port_number + "proxy_type=" + proxy_type + "proxy_id=" + proxy_id + "customer_auth=" + customer_auth + "customer_id=" + customer_id + "proxy_username=" + proxy_username + "proxy_password=" + proxy_password + "whitelist=" + whitelist + "expiration=" + expiration;
// create a request
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create(serviceUri);
request.Method = "POST";
// turn our request string into a byte stream
byte[] postBytes = System.Text.Encoding.ASCII.GetBytes(post_data);
// this is important - make sure you specify type this way
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postBytes.Length;
Stream requestStream = request.GetRequestStream();
// now send it
requestStream.Write(postBytes, 0, postBytes.Length);
requestStream.Close();
// grab te response and print it out to the console
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Console.WriteLine(new StreamReader(response.GetResponseStream()).ReadToEnd());
Console.ReadLine();
}
}
curl -X POST -F 'api_key=REPLACE_WITH_YOUR_API_KEY' -F 'router_id=845' -F 'category_id=985' -F 'port_number=3129' -F 'proxy_type=1' -F 'proxy_id=145' -F 'customer_auth=1' -F 'customer_id=1' -F 'proxy_username=TestProxyUsername' -F 'proxy_password=TestProxyPassword123' -F 'whitelist=111.222.333,444.555.666,777.888.999' -F 'expiration=0' https://createproxy.com/api/request/router/add_credentials/
import requests
files = {
'api_key': (None, 'REPLACE_WITH_YOUR_API_KEY'),
'router_id': (None, '845'),
'category_id': (None, '985'),
'port_number': (None, '3129'),
'proxy_type': (None, '1'),
'proxy_id': (None, '145'),
'customer_auth': (None, '1'),
'customer_id': (None, '1'),
'proxy_username': (None, 'TestProxyUsername'),
'proxy_password': (None, 'TestProxyPassword123'),
'whitelist': (None, '111.222.333,444.555.666,777.888.999'),
'expiration': (None, '0'),
}
response = requests.post('https://createproxy.com/api/request/router/add_credentials/', files=files)