public function addTwilioNumber() { // Get Twilio Phone // Initiate Twilio $sid = Yii::$app->params['twilioId']; $token = Yii::$app->params['twilioToken']; $client = new Twilio\Rest\Client($sid, $token); $numbers = $client->availablePhoneNumbers('US')->local->read(["areaCode" => "561"]); // Purchase the first number on the list. $number = $client->incomingPhoneNumbers->create(["phoneNumber" => $numbers[0]->phoneNumber, 'FriendlyName' => 'Project - ' . $this->title, 'SmsUrl' => 'http://portal.frontrunnercasting.com/message/incoming/' . $this->id, 'SmsMethod' => 'POST', 'Capabilities' => ['SMS' => true]]); $this->twilio_number = $numbers[0]->phoneNumber; $this->save(); }
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $conference = $client->conferences("CFbbe46ff1274e283f7e3ac1df0072ab39")->fetch(); echo $conference->status;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); $client->messages("MM800f449d0399ed014aae2bcc0cc2f2ec")->media("ME557ce644e5ab84fa21cc21112e22c485")->delete();
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library // Use the REST API Client to make requests to the Twilio REST API use Twilio\Rest\Client; $uniqueId = $_REQUEST['id']; // Lookup variable `$uniqueId` in a database to find messageSid $messageSid = 'SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; // Your Account SID and Auth Token from twilio.com/console $accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; $authToken = 'your_auth_token'; $client = new Client($accountSid, $authToken); $client->messages($messageSid)->feedback->create(array("outcome" => "confirmed")); echo 'Thank you!';
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $call = $client->calls("CAe1644a7eed5088b159577c5802d8be38")->update(array("status" => "completed")); echo $call->direction;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $number = $client->incomingPhoneNumbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e")->fetch(); echo $number->phoneNumber;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $shortCode = $client->shortCodes("SC6b20cb705c1e8f00210049b20b70fce2")->fetch(); echo $shortCode->shortCode;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $app = $client->applications("AP2a0747eba6abf96b7e3c3ff0b4530f6e")->fetch(); echo $app->smsUrl;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $authorizedApp = $client->authorizedConnectApps("CN47260e643654388faabe8aaa18ea6756")->fetch(); echo $authorizedApp->connectAppHomepageUrl;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); $numbers = $client->availablePhoneNumbers('GB')->local->read(array("voiceEnabled" => "true")); // Purchase the first number on the list. $number = $client->incomingPhoneNumbers->create(array("phoneNumber" => $numbers[0]->phoneNumber)); echo $number->sid;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $app = $client->applications("AP2a0747eba6abf96b7e3c3ff0b4530f6e")->update(array("voiceUrl" => "http://demo.twilio.com/docs/voice.xml", "smsUrl" => "http://demo.twilio.com/docs/sms.xml")); echo $app->voiceUrl;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); $numbers = $client->availablePhoneNumbers('GB')->local->read(array("contains" => "4420")); // Purchase the first number on the list. $number = $client->incomingPhoneNumbers->create(array("phoneNumber" => $numbers[0]->phoneNumber)); echo $number->sid;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page // You can call $client->account to access the authenticated account // you used to initialize the client and call update() on that object. $account = $client->accounts("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")->update(array('status' => 'suspended')); echo $account->dateCreated->format('Y-m-d H:i:s');
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); $numbers = $client->availablePhoneNumbers('US')->local->read(array("nearLatLong" => "37.840699,-122.461853", "distance" => "50", "contains" => "555", "inRegion" => "CA")); // Purchase the first number on the list. $number = $client->incomingPhoneNumbers->create(array("phoneNumber" => $numbers[0]->phoneNumber)); echo $number->sid;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); $numbers = $client->availablePhoneNumbers('US')->local->read(array("contains" => "STORM")); // Purchase the first number on the list. $number = $client->incomingPhoneNumbers->create(array("phoneNumber" => $numbers[0]->phoneNumber)); echo $number->sid;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); $client->messages("MM5ef8732a3c49700934481addd5ce1659")->delete(); // Deletes entire message record
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $connectApp = $client->connectApps("CNb989fdd207b04d16aee578018ef5fd93")->fetch(); echo $connectApp->homepageUrl;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); $numbers = $client->availablePhoneNumbers('GB')->mobile->read(); // Purchase the first number on the list. $number = $client->incomingPhoneNumbers->create(array("phoneNumber" => $numbers[0]->phoneNumber)); echo $number->sid;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $address = $client->addresses("AD2a0747eba6abf96b7e3c3ff0b4530f6e")->fetch(); echo $address->customerName;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page // You can call $client->account to access the authenticated account // you used to initialize the client and call update() on that object. $account = $client->accounts("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")->update(array('status' => 'active')); echo $account->dateCreated->format('Y-m-d H:i:s');
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); $numbers = $client->availablePhoneNumbers('US')->local->read(array("excludeLocalAddressRequired" => "true")); // Purchase the first number on the list. $number = $client->incomingPhoneNumbers->create(array("phoneNumber" => $numbers[0]->phoneNumber)); echo $number->sid;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $message = $client->messages("MM800f449d0399ed014aae2bcc0cc2f2ec")->fetch(); echo $message->body;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $call = $client->calls("CAe1644a7eed5088b159577c5802d8be38")->update(array("url" => "http://demo.twilio.com/docs/voice.xml", "method" => "POST")); echo $call->to;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); $members = $client->queues("QU5ef8732a3c49700934481addd5ce1659")->members->read(); // Loop over the list of members and echo a property for each one foreach ($members as $member) { echo $member->position; }
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page // You can call $client->account to access the authenticated account // you used to initialize the client and call update() on that object. $account = $client->accounts("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")->update(array('status' => 'closed')); echo $account->dateCreated->format('Y-m-d H:i:s');
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $callerId = $client->outgoingCallerIds("PNe536d32a3c49700934481addd5ce1659")->update(array("friendlyName" => "My Second Line")); echo $callerId->phoneNumber;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $member = $client->queues("QU5ef8732a3c49700934481addd5ce1659")->members("Front")->update("http://demo.twilio.com/docs/voice.xml", "POST"); echo $member->waitTime;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $number = $client->incomingPhoneNumbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e")->update(array("voiceUrl" => "http://demo.twilio.com/docs/voice.xml", "smsUrl" => "http://demo.twilio.com/docs/sms.xml")); echo $number->voiceUrl;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $call = $client->calls("CA42ed11f93dc08b952027ffbc406d0868")->fetch(); echo $call->to;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Rest\Client; // Your Account Sid and Auth Token from twilio.com/user/account $sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $token = "your_auth_token"; $client = new Client($sid, $token); // Get an object from its sid. If you do not have a sid, // check out the list resource examples on this page $feedback = $client->calls("CAe03b7cd806070d1f32bdb7f1046a41c0")->feedback()->fetch(); echo $feedback->dateCreated->format('Y-m-d H:i:s');