Created
May 15, 2018 05:50
-
-
Save jdc-cunningham/b1e633faf776f5e821ac0efb0b5908fb to your computer and use it in GitHub Desktop.
Make a call through Twilio using PHP and read XML file contents
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
/* | |
The URL is an XML file telling Twilio's phone call "bot?" what to do | |
View an example here https://gist.github.com/jdc-cunningham/af131c042309d1ccd8acd5bcc626b0de | |
The code below is from Twilio's example | |
https://www.twilio.com/docs/voice/make-calls | |
*/ | |
<?php | |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR.'./../twilio-php/Twilio/autoload.php'); | |
use Twilio\Rest\Client; | |
// Your Account Sid and Auth Token from twilio.com/console | |
$sid = ""; | |
$token = ""; | |
$twilio = new Client($sid, $token); | |
$call = $twilio->calls | |
->create("target number", | |
"your Twilio phone number", | |
array('url' => "http://your-ip/msg.xml") | |
); | |
print($call->sid); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment