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
# encoding: utf-8 | |
require 'rubygems' | |
require 'twilio-ruby' | |
account_sid = '<Account SID>' | |
auth_token = '<Auth Token>' | |
client = Twilio::REST::Client.new(account_sid, auth_token) | |
from = "+141xxxxxxxx" |
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
require 'sinatra' | |
require 'twilio-ruby' | |
get '/' do | |
<<-HTML | |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<title>Twilio API</title> | |
<ul> | |
<li><a href="/sample">/sample</a></li> |
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
<?php | |
header("content-type: text/xml"); | |
// 発信者番号を取得します。 | |
$tel_from = $_POST['From']; | |
// 録音ファイルのURLを取得します。 | |
$recording_url = $_POST['RecordingUrl']; | |
?> | |
<Response> | |
<?PHP if (!empty($recording_url)): ?> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<Response> | |
<Play>http://xxx.xxx.xxx.xxx/play/play.mp3</Play> | |
</Response> |
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
require 'koala' # gem install koala --no-document | |
# create a facebook app and get access token from here | |
# https://developers.facebook.com/tools/explorer | |
# select "read_mailbox" when authenticating | |
oauth_access_token = 'xxxxxxxxxxxxxxxxxxxxxx' | |
graph = Koala::Facebook::API.new(oauth_access_token) | |
# get all latest messages | |
limit = 10 |
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
# Get twilio-ruby from twilio.com/docs/ruby/install | |
require 'rubygems' # This line not needed for ruby > 1.8 | |
require 'twilio-ruby' | |
# Get your Account Sid and Auth Token from twilio.com/user/account | |
account_sid = 'Account SID' | |
auth_token = 'Auth Token' | |
@client = Twilio::REST::Client.new account_sid, auth_token | |
# Get an object from its sid. If you do not have a sid, |
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
<?php | |
require("../Services/Twilio.php"); | |
$response = new Services_Twilio_Twiml(); | |
if (empty($_POST["Digits"])) { | |
$gather = $response->gather(array('numDigits' => 1, 'timeout' => 30)); | |
$gather->say("許可するには1を拒否は2を押してください。", array('language' => 'ja-jp')); | |
} elseif ($_POST["Digits"] == "1") { | |
$response->say("許可を選びました。", array('language' => 'ja-jp')); |
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
<?php | |
require('../Services/Twilio.php'); | |
$account_sid = "AC**************************"; // Your Twilio account sid | |
$auth_token = "**************************"; // Your Twilio auth token | |
// Download data from Twilio API | |
$client = new Services_Twilio($account_sid, $auth_token); | |
$calls = $client->account->calls->getIterator(0, 1000, array( | |
'StartTime>' => '2013-11-19', |
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
<?php | |
require('Services/Twilio.php'); | |
$account_sid = "ACXXXXXX"; // Your Twilio account sid | |
$auth_token = "YYYYYY"; // Your Twilio auth token | |
$client = new Services_Twilio($account_sid, $auth_token); | |
$message = $client->account->messages->sendMessage( | |
'+1xxxxyyyy', // From a Twilio number in your account | |
'+8180xxxxyyyy', // Text any number |
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
<?php | |
mb_language("Japanese"); | |
mb_internal_encoding("UTF-8"); | |
$userArr = array( | |
'+8150xxxxyyyy' => array('+8150xxxxyyyy','sip:xxx@sip.yyy.com','+8180xxxxyyyy','xxx@yyyy.com','担当1'), | |
'+8150xxxxyyyy' => array('+8150xxxxyyyy','sip:xxx@sip.yyy.com','+8180xxxxyyyy','xxx@yyyy.com','担当2'), | |
'+8150xxxxyyyy' => array('+8150xxxxyyyy','sip:xxx@sip.yyy.com','+8180xxxxyyyy','xxx@yyyy.com','担当3') | |
); |
OlderNewer