Skip to content

Instantly share code, notes, and snippets.

@andrewwatson
Created June 8, 2011 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewwatson/1015496 to your computer and use it in GitHub Desktop.
Save andrewwatson/1015496 to your computer and use it in GitHub Desktop.
Upgrade Phone Number
<?php
$sn = $argv[1];
$asid = $argv[2];
$sid = "ACxxxxx";
$token = "xxxxx";
$url = "https://api.twilio.com/2010-04-01/Accounts/${asid}/IncomingPhoneNumbers/${sn}";
printf("%s\n",$url);
$vars = "ApiVersion=2010-04-01";
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_USERPWD, "$sid:$token");
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$vars);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
$xml = simplexml_load_string($result);
//var_dump($result);
printf("%s\n",$info['http_code']);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment