$token = "{YOUR_TOKEN_HERE}";
$response = post("https://thedncproject.org/api/v2/scrubs", $token, [
3105551212, 3105551213, 3105551214, 3105551215, 3105551216
], [
'dnc_mobile'
]);
/**
* @param string $apiUrl API endpoint
* @param string $token Your personal access token
* @param array $numbers Numbers to scrub
* @param array $scrubTypes Scrub types to run
* @return array|null
*/
function post(string $apiUrl, string $token, array $numbers, array $scrubTypes) {
$authorization = "Authorization: Bearer {$token}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, [ $authorization ]);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
// Remember to wrap your numbers and scrub_type inside their respective variables.
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'numbers' => $numbers,
'scrub_type' => $scrubTypes
]));
$result = curl_exec($ch);
curl_close($ch);
return json_decode($result);
}
{#2644
+"result": array:5 [
0 => {#2652
+"number": "3105551212"
+"is_dnc": true
+"is_mobile": true
+"state_co": true
+"state_fl": true
+"state_tx": true
}
...
4 => {#2649
+"number": "3105551216"
+"is_dnc": true
+"state_co": true
+"state_fl": true
+"state_tx": true
}
]
}
// You can submit multiple numbers.
// api is limited to 60 request/min
axios.post("https://thedncproject.org/api/v2/scrubs", {
numbers: [
'3105551212',
'3105551213',
'3105551214',
'3105551215',
'3105551216',
],
scrub_type: [
'dnc_mobile'
]
}, {
headers: {
Authorization: `Bearer ${token}`
}
})
.then(response => {
// success response
}).catch(error => {
// error response
})
{#2644
+"result": array:5 [
0 => {#2652
+"number": "3105551212"
+"is_dnc": true
+"is_mobile": true
+"state_co": true
+"state_fl": true
+"state_tx": true
}
...
4 => {#2649
+"number": "3105551216"
+"is_dnc": true
+"state_co": true
+"state_fl": true
+"state_tx": true
}
]
}