Last active
February 8, 2016 14:52
-
-
Save dtolb/d6aafd1d4c9ddc2329dc to your computer and use it in GitHub Desktop.
Number order PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Ordering a phone number from bandwidth (http://bit.ly/1QQtoCF) | |
Information pulled from http://bit.ly/1okTYuf | |
*/ | |
// Be sure to update the user id, token, and secret | |
$url = "https://{YOUR_TOKEN}:{YOUR_SECRET}@api.catapult.inetwork.com/v1/users/{YOUR_USERID}/phoneNumbers"; | |
// Be sure that the number is available | |
$data = array( | |
"number" => "+15623750310" | |
); | |
// Encode the $data array | |
$data_string = json_encode($data); | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
// Still need to set the Content-Type | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | |
'Content-Type: application/json', | |
'Content-Length: ' . strlen($data_string)) | |
); | |
$result = curl_exec($ch); | |
printf($result); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment