PHP code example of ezknock / ezknock-php-sdk
1. Go to this page and download the library: Download ezknock/ezknock-php-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/ */
ezknock / ezknock-php-sdk example snippets
use EZKnock\Client as EZKClient;
$client = new EZKClient('<insert_token_here>');
$client->setHttpClient($yourHttpClient);
$client->setRequestFactory($yourRequestFactory);
$client->setUriFactory($yourUriFactory);
try {
$data = $client->buyers->coverage('73301');
print_r($data);
} catch (Exception $ex) {
print_r($ex->getMessage());
print_r($ex->getDebug());
}
$data = [
'recipients' => [
[
'firstname' => 'Ryann',
'lastname' => 'Ullrich',
'company' => 'Romaguera, Yundt and Marvin',
'email' => '[email protected] '
]
],
'address' => '2453 W Vita Locks Rapids',
'address_2' => 'BLDG 377',
'city' => 'Austin',
'state' => 'TX',
'zip' => '78749',
'return_type' => 'default',
'originals' => false,
'witnessfees' => true,
'instructions' => 'Aut perferendis et necessitatibus. Vel tempore molestiae ut nihil dolore. Rem dolor sed nulla cupiditate.',
'min_attempts' => 3,
'documents' => 'ORDER FOR ALTERNATIVE SERVICE AND TO EXTEND TIME FOR SERVICE OF PROCESS; SUMMONS; COMPLAINT; EXHIBIT; NOTICE TO DEFENDANT',
'attempt_by' => '2021-05-10',
'diligence_by' => '2021-05-15',
'complete_by' => '2021-05-20',
'service_files' => [fopen('/path/to/file.pdf', 'r')],
'other_files' => [fopen('/path/to/file.pdf', 'r')],
'return_file' => fopen('/path/to/file.pdf', 'r'),
'qualifications' => [1, 2, 3],
'costs' => [
[
'name' => 'delivery',
'amount' => 50
],
[
'name' => 'rush',
'amount' => 20
]
]
];
try {
$order = $client->buyers->createOrder($data);
print_r($order);
} catch (Exception $ex) {
print_r($ex->getMessage());
print_r($ex->getDebug());
}
$rate_limit = $client->getRateLimit();
print("{$rate_limit['remaining']} {$rate_limit['limit']} \n");
print_r($rate_limit['reset_at']->format(DateTime::ISO8601));
$client->nextPage($response->pages);
try {
$user = $client->buyers->coverage('73301');
} catch(Http\Client\Exception $e) {
if ($e->getCode() == '404') {
// Handle 404 error
return;
} else {
throw $e;
}
}
sh
composer