1. Go to this page and download the library: Download proxy-seller/user-api-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
proxy-seller / user-api-php example snippets
roxySeller\Userapi\Api;
use ProxySeller\Userapi\ApiException;
$api = new Api([
'key' => 'YOUR_API_KEY',
'fingerprint' => 'my-installation-id', // optional X-Fingerprint for order/make, see below
'timeout' => 30, // seconds, every call except payments (the default)
'moneyTimeout' => 120, // seconds, order/make, prolong/make, balance/add (the default)
'connect_timeout' => 5,
]);
echo $api->balance();
$api->setPaymentCode('balance'); // or 'paddle_subscription' to pay with the saved card
// per call, in the final options array:
$api->orderMakeIpv4('USA', '1m', 1, null, null, 'my target', ['paymentCode' => 'balance']);
$api = new Api(['key' => 'YOUR_API_KEY', 'baseUrl' => 'http://localhost:7995/personal/api/v2/']);
$order = $api->orderMakeIpv4('USA', '1m', 1, null, null, 'my target');
$orderId = $order['orderId']; // string, keep it as a string
$proxies = $api->proxyList('ipv4', ['orderId' => $orderId]);
// referenceList('mobile') returns ['items' => <section>]; without a type it returns a map of sections
$section = $api->referenceList('mobile')['items'];
$operator = $section['country'][0]['operators']['dedicated'][0];
// $operator = ['id' => 'ee_unitedkingdom', 'name' => 'EE', 'rotations' => [['id' => 5, 'name' => '5 minutes'], …]]
$mobile = $api->orderCalcMobile(
'USA', // from reference/list -> country[].id
'1m', // from reference/list -> period[].id
1, // quantity
null, // authorization — optional
null, // coupon — optional
$operator['id'], // operator code, e.g. 'ee_unitedkingdom' (case-sensitive)
5, // rotationId: MINUTES, 0 = By Link. Not a code — '5m' is rejected
'dedicated' // shared or dedicated;
$orders = $api->orderList([
'status' => 'PAYED', // PAYED | NOT_PAYED | RETURN — the status_type of the response
'sort_by' => 'date_insert', // date_insert | summ | status
'order' => 'desc',
'page' => 1,
'limit' => 20,
]);
$all = $api->orderList(); // the same call with no filters at all
$api = new Api(['key' => 'YOUR_API_KEY', 'fingerprint' => 'my-installation-id']);
// or later:
$api->setFingerprint('my-installation-id');
// or for a single call:
$api->orderMakeResident('tarif-code', null, ['fingerprint' => 'my-installation-id']);
// ipv4 / isp / mobile — per proxy, by address (or by the proxy id)
$ipv4 = $api->proxyList('ipv4')['items'];
$ips = array_column($ipv4, 'ip'); // ['1.2.3.4', '5.6.7.8']
$quote = $api->prolongCalc('ipv4', $ips, '1m'); // price first
echo $quote['total'];
$order = $api->prolongMake('ipv4', $ips, '1m'); // deducts money
echo $order['orderId']; // the first of $order['orderIds']
// ipv6 / mix / mix_isp — whole orders, by order id
$ipv6 = $api->proxyList('ipv6')['items'];
$orders = array_values(array_unique(array_column($ipv6, 'order_id')));
$order = $api->prolongMake('ipv6', $orders, '1m');
print_r($order['orderIds']); // every renewed order
$api->autoProlongCalc('ipv4', ['1.2.3.4'], '1m', ['paymentId' => 'balance']);
$api->autoProlongEnable('ipv4', ['1.2.3.4'], '1m', ['paymentId' => 'balance']);
$api->autoProlongDisable('ipv4', ['1.2.3.4']);
// ipv6 / mix / mix_isp — the whole order at once
$api->autoProlongEnable('ipv6', [$orderId], '1m', ['paymentId' => 'balance']);
$api->autoProlongDisable('ipv6', [$orderId]);
try {
$api->proxyList('ipv4');
} catch (ApiException $e) {
if ($e->isAccessError()) {
// key / IP allowlist / rate limit — the server does not say which, so the SDK
// does not retry it. Log every message; retry later only if key and IP are right.
error_log(implode(' | ', $e->getMessages()));
}
throw $e;
}
try {
$order = $api->orderMakeIpv4('USA', '1m', 1, null, null, 'my target');
} catch (ApiException $e) {
if (!$e->getErrors() && $e->getHttpStatus() !== 429) {
// no verdict from the API: the order may exist — look it up with orderList() before retrying
}
throw $e;
}
echo $api->balance(); // float
foreach ($api->balancePaymentsList() as $ps) {
echo $ps['id'], ' ', $ps['name'], PHP_EOL; // id is an ObjectId string
}
$url = $api->balanceAdd(25, '66f0c2a1b4d3e5f6a7b8c9d0');
$state = $api->balanceAutoTopupGet();
// configured, enabled, state (NO_PAYMENT_METHOD | DISABLED | ACTIVE | PAYMENT_INVALID | PAUSED_FAILURES),
// threshold, amount, subscriptionId, paymentMethod,
// failCount, lastAttemptAt, lastEvent
// Partial update: only the fields you pass are sent, everything else keeps its stored value.
$after = $api->balanceAutoTopupSet(['threshold' => 10]);
$after = $api->balanceAutoTopupSet(['enabled' => false]);
$api->proxyReplace(['66f0c2a1b4d3e5f6a7b8c9d0'], 'NOT_WORK');
$api->proxyReplace($ids, 'CUSTOM', 'IPs are blocked by the target site');
sh
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.