PHP code example of mobirox / mobileproxy-sdk

1. Go to this page and download the library: Download mobirox/mobileproxy-sdk 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/ */

    

mobirox / mobileproxy-sdk example snippets


use MobileProxy\Client;
use MobileProxy\Exception\ApiException;

$client = new Client('YOUR_API_TOKEN');

// Check balance
$balance = $client->getBalance();
echo "Balance: {$balance['balance']}";

// List active proxies
$proxies = $client->getMyProxy();

// Get current IP of a proxy
$ip = $client->getProxyIp(12345);

// Rotate IP (no rate limit)
$client->changeIp('your_proxy_key');

use MobileProxy\Exception\ApiException;
use MobileProxy\Exception\AuthenticationException;
use MobileProxy\Exception\RateLimitException;

try {
    $client->getBalance();
} catch (AuthenticationException $e) {
    // Invalid API token
} catch (RateLimitException $e) {
    // Too many requests — back off and retry
    // Limit: 3 × (number of active proxies) requests/sec
} catch (ApiException $e) {
    echo $e->getMessage();
    echo $e->getHttpCode();
    print_r($e->getResponseBody());
}

$client = new Client('YOUR_API_TOKEN', [
    'timeout' => 120,    // request timeout in seconds
    'debug'   => true,   // enable cURL verbose output
]);