Skip to content

Instantly share code, notes, and snippets.

@jdc-cunningham
Created May 15, 2018 05:50
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 jdc-cunningham/b1e633faf776f5e821ac0efb0b5908fb to your computer and use it in GitHub Desktop.
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
/*
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