这是indexloc提供的服务,不要输入任何密码
Skip to content

A PHP library for communicating with the Twilio REST API and generating TwiML. Need help? Post your questions to http://getsatisfaction.com/twilio or email us at help@twilio.com

License

Notifications You must be signed in to change notification settings

pcbrsites/twilio-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twilio API helper library

Prerequisites

  • PHP >= 5.2.1
  • The PHP JSON extension

Installing

Via PEAR:

pear channel-discover twilio.github.com/pear
pear install twilio/Services_Twilio

If you aren't using PEAR, you can just download the source

Full Documentation

http://readthedocs.org/docs/twilio-php/en/latest/

Quickstart

Getting started with the Twilio API couldn't be easier. Create a Twilio REST client to get started. For example, the following code makes a call using the Twilio REST API.

Making a Call

require "Services/Twilio.php";

$sid = "ACXXXXXX"; // Your Twilio account sid
$token = "YYYYYY"; // Your Twilio auth token

$client = new Services_Twilio($sid, $token);
$call = $client->account->calls->create(
    '9991231234', // From this number
    '8881231234', // Call this number
    'http://foo.com/call.xml'
);

Generating TwiML

To control phone calls, your application need to output TwiML. Use Services_Twilio_Twiml to easily create such responses.

$response = new Services_Twilio_Twiml();
$response->say('Hello');
$response->play('monkey.mp3', array("loop" => 5));
print $response;
<?xml version="1.0" encoding="utf-8"?>
<Response>
  <Say>Hello</Say>
  <Play loop="5">monkey.mp3</Play>
</Response>

About

A PHP library for communicating with the Twilio REST API and generating TwiML. Need help? Post your questions to http://getsatisfaction.com/twilio or email us at help@twilio.com

Resources

License

Stars

Watchers

Forks

Packages

No packages published