コード例 #1
0
ファイル: Project.php プロジェクト: jcshep/FrontRunner
 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();
 }
コード例 #2
0
<?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;
コード例 #3
0
<?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();
コード例 #4
0
<?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!';
コード例 #5
0
<?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;
コード例 #6
0
<?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;
コード例 #7
0
<?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;
コード例 #8
0
<?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;
コード例 #9
0
<?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;
コード例 #10
0
<?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;
コード例 #11
0
<?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;
コード例 #12
0
<?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;
コード例 #13
0
<?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');
コード例 #14
0
<?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;
コード例 #15
0
<?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;
コード例 #16
0
<?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
コード例 #17
0
<?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;
コード例 #18
0
<?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;
コード例 #19
0
<?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;
コード例 #20
0
<?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');
コード例 #21
0
<?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;
コード例 #22
0
<?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;
コード例 #23
0
<?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;
コード例 #24
0
<?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;
}
コード例 #25
0
<?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');
コード例 #26
0
<?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;
コード例 #27
0
<?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;
コード例 #28
0
<?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;
コード例 #29
-1
<?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;
コード例 #30
-1
<?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');