PHP code example of vegas0250 / cdeker

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

    

vegas0250 / cdeker example snippets



$cdekerClient = new Vegas0250\Cdeker\Client( '<clientId>', '<clientSecret>');

# Или тестовый аккаунт

$cdekerClient = new Client(
    'wqGwiQx0gg8mLtiEKsUinjVSICCjtTEP',
    'RmAmgvSgSl1yirlz9QupbzOJVqhCxcP5',
    true
);

$result = $cdekerClient->get('/v2/location/regions', [
    'size' => 1
]);

print_r($result);

$result = $cdekerClient->post('/v2/calculator/tarifflist', [
    'from_location' => [
        'code' => 248
    ],
    'to_location' => [
        'code' => 250
    ],
    'packages' => [
        'weight' => 5000
    ]
]);

print_r($result);

$result = $cdekerClient->request('/v2/calculator/tarifflist', Client::METHOD_POST, [
    'from_location' => [
        'code' => 248
    ],
    'to_location' => [
        'code' => 250
    ],
    'packages' => [
        'weight' => 5000
    ]
]);

print_r($result);