import requests
class OldProxyAPI:
def __init__(self, api_key):
self.api_key = api_key
self.base_url = "https://oldproxy.com/api"
self.headers = {
"X-API-Key": api_key,
"Content-Type": "application/json"
}
def create_proxy(self, traffic_gb, packet_name=None):
url = f"{self.base_url}/v1/residential-rotating-proxy"
data = {
"traffic_gb": traffic_gb,
"packet_name": packet_name
}
response = requests.post(url, json=data, headers=self.headers)
return response.json()
def get_proxies(self):
url = f"{self.base_url}/v1/proxies"
response = requests.get(url, headers=self.headers)
return response.json()
# Usage
api = OldProxyAPI("your-api-key-here")
result = api.create_proxy(50, "My Proxy Package")
print(result)
const axios = require('axios');
class OldProxyAPI {
constructor(apiKey) {
this.apiKey = apiKey;
this.baseURL = 'https://oldproxy.com/api';
this.headers = {
'X-API-Key': apiKey,
'Content-Type': 'application/json'
};
}
async createProxy(trafficGB, packetName = null) {
try {
const response = await axios.post(
`${this.baseURL}/v1/residential-rotating-proxy`,
{
traffic_gb: trafficGB,
packet_name: packetName
},
{ headers: this.headers }
);
return response.data;
} catch (error) {
throw new Error(`API Error: ${error.message}`);
}
}
async getProxies() {
try {
const response = await axios.get(
`${this.baseURL}/v1/proxies`,
{ headers: this.headers }
);
return response.data;
} catch (error) {
throw new Error(`API Error: ${error.message}`);
}
}
}
// Usage
const api = new OldProxyAPI('your-api-key-here');
api.createProxy(50, 'My Proxy Package')
.then(result => console.log(result))
.catch(error => console.error(error));
apiKey = $apiKey;
}
private function makeRequest($method, $endpoint, $data = null) {
$url = $this->baseURL . $endpoint;
$headers = [
'X-API-Key: ' . $this->apiKey,
'Content-Type: application/json'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
if ($method === 'POST' && $data) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
}
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
public function createProxy($trafficGB, $packetName = null) {
$data = [
'traffic_gb' => $trafficGB,
'packet_name' => $packetName
];
return $this->makeRequest('POST', '/v1/residential-rotating-proxy', $data);
}
public function getProxies() {
return $this->makeRequest('GET', '/v1/proxies');
}
}
// Usage
$api = new OldProxyAPI('your-api-key-here');
$result = $api->createProxy(50, 'My Proxy Package');
print_r($result);
?>
# Create a new proxy package
curl -X POST https://oldproxy.com/api/v1/residential-rotating-proxy \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"traffic_gb": 50,
"packet_name": "My Proxy Package"
}'
# Get all proxies
curl -X GET https://oldproxy.com/api/v1/proxies \
-H "X-API-Key: your-api-key-here"
# Get account balance
curl -X GET https://oldproxy.com/api/v1/balance \
-H "X-API-Key: your-api-key-here"
# Sync proxy status
curl -X POST https://oldproxy.com/api/v1/proxy/prx_123/sync \
-H "X-API-Key: your-api-key-here"
# Add bandwidth to existing proxy
curl -X POST https://oldproxy.com/api/v1/proxy/prx_123/add-bandwidth \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"traffic_gb": 25
}'