Skip to content

Instantly share code, notes, and snippets.

@andrewwatson
Created June 9, 2011 21:40
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/1017816 to your computer and use it in GitHub Desktop.
Save andrewwatson/1017816 to your computer and use it in GitHub Desktop.
set URL
<?php
$sn = $argv[1];
$asid = $argv[2];
$vurl = $argv[3];
$sid = "ACxxxxxxxxxxxxxxxxxxxx";
$token = "xxxxxxxxxxxxxxx";
$url = "https://api.twilio.com/2010-04-01/Accounts/${asid}/IncomingPhoneNumbers/${sn}";
printf("%s\n",$url);
$vars = "VoiceUrl=${vurl}";
$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