This API method help you to create Upcloud Proxies.
Name | Requirements | Options | |
---|---|---|---|
api_key | string|required | Get your api key from https://createproxy.com/dashboard/api | |
gprofile | string|required | Get profile_id from https://createproxy.com/api/cloud/get_account_list/ | |
glocation | string|required | Find available datacenter locations at https://createproxy.com/dashboard/upcloud/ | |
ginstance | string|required | Find available instances at https://createproxy.com/dashboard/upcloud/ | |
service | string|required | ipv4|ipv4_new | |
gproxy | required|numeric|min_len,1|max_len,3 | Number of proxy servers that you want to create | |
gport | numeric|min_len,3|max_len,4 | Port number that will be used, ignored for ipv4_new all other services may apply | |
gusername | string | Optional username for proxy (applied only for ipv4 and ipv4_socks_auth service) if blank automatic credentials will be generated no special characters use only letters | |
gpassword | string | Optional password for proxy (applied only for ipv4 and ipv4_socks_auth service) if blank automatic credentials will be generated, no special characters | |
grestriction | string | Allowed IP Addresses to use this proxies divided by comma ex: 111.222.333,444.555.666,7777.888.999, required only for service ipv4_socks_ip |
// Read more at https://createproxy.com/api/cloud/create_upcloud_proxies/
// 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['gprofile'] = "MyProfileID"; // Get profile_id from https://createproxy.com/api/cloud/get_account_list/
$params['glocation'] = ""; // Find available datacenter locations at https://createproxy.com/dashboard/upcloud/
$params['ginstance'] = ""; // Find available instances at https://createproxy.com/dashboard/upcloud/
$params['service'] = "ipv4"; // ipv4|ipv4_new
$params['gproxy'] = "5"; // Number of proxy servers that you want to create
$params['gport'] = "3128"; // Port number that will be used, ignored for ipv4_new all other services may apply
$params['gusername'] = "MyName"; // Optional username for proxy (applied only for ipv4 and ipv4_socks_auth service) if blank automatic credentials will be generated no special characters use only letters
$params['gpassword'] = "MyPassword123456"; // Optional password for proxy (applied only for ipv4 and ipv4_socks_auth service) if blank automatic credentials will be generated, no special characters
$params['grestriction'] = "111.222.333,444.555.666,7777.888.999"; // Allowed IP Addresses to use this proxies divided by comma ex: 111.222.333,444.555.666,7777.888.999, required only for service ipv4_socks_ip
try {
$request = $client->request('cloud','create_upcloud_proxies',$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/cloud/create_upcloud_proxies/ -->
$api_url = "https://createproxy.com/api/request/cloud/create_upcloud_proxies/";
$params = array();
$params['api_key'] = "REPLACE_WITH_YOUR_API_KEY"; // Get your api key from https://createproxy.com/dashboard/api
$params['gprofile'] = "MyProfileID"; // Get profile_id from https://createproxy.com/api/cloud/get_account_list/
$params['glocation'] = ""; // Find available datacenter locations at https://createproxy.com/dashboard/upcloud/
$params['ginstance'] = ""; // Find available instances at https://createproxy.com/dashboard/upcloud/
$params['service'] = "ipv4"; // ipv4|ipv4_new
$params['gproxy'] = "5"; // Number of proxy servers that you want to create
$params['gport'] = "3128"; // Port number that will be used, ignored for ipv4_new all other services may apply
$params['gusername'] = "MyName"; // Optional username for proxy (applied only for ipv4 and ipv4_socks_auth service) if blank automatic credentials will be generated no special characters use only letters
$params['gpassword'] = "MyPassword123456"; // Optional password for proxy (applied only for ipv4 and ipv4_socks_auth service) if blank automatic credentials will be generated, no special characters
$params['grestriction'] = "111.222.333,444.555.666,7777.888.999"; // Allowed IP Addresses to use this proxies divided by comma ex: 111.222.333,444.555.666,7777.888.999, required only for service ipv4_socks_ip
$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/cloud/create_upcloud_proxies/
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 gprofile = "MyProfileID";
string glocation = "";
string ginstance = "";
string service = "ipv4";
string gproxy = "5";
string gport = "3128";
string gusername = "MyName";
string gpassword = "MyPassword123456";
string grestriction = "111.222.333,444.555.666,7777.888.999";
string serviceUri = "https://createproxy.com/api/request/cloud/create_upcloud_proxies/";
string post_data = "api_key=" + api_key + "gprofile=" + gprofile + "glocation=" + glocation + "ginstance=" + ginstance + "service=" + service + "gproxy=" + gproxy + "gport=" + gport + "gusername=" + gusername + "gpassword=" + gpassword + "grestriction=" + grestriction;
// 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 'gprofile=MyProfileID' -F 'glocation=' -F 'ginstance=' -F 'service=ipv4' -F 'gproxy=5' -F 'gport=3128' -F 'gusername=MyName' -F 'gpassword=MyPassword123456' -F 'grestriction=111.222.333,444.555.666,7777.888.999' https://createproxy.com/api/request/cloud/create_upcloud_proxies/
import requests
files = {
'api_key': (None, 'REPLACE_WITH_YOUR_API_KEY'),
'gprofile': (None, 'MyProfileID'),
'glocation': (None, ''),
'ginstance': (None, ''),
'service': (None, 'ipv4'),
'gproxy': (None, '5'),
'gport': (None, '3128'),
'gusername': (None, 'MyName'),
'gpassword': (None, 'MyPassword123456'),
'grestriction': (None, '111.222.333,444.555.666,7777.888.999'),
}
response = requests.post('https://createproxy.com/api/request/cloud/create_upcloud_proxies/', files=files)