Skip to content

Instantly share code, notes, and snippets.

View hunnycode's full-sized avatar

joohoun song hunnycode

View GitHub Profile
@hunnycode
hunnycode / kor-twilio-sms.rb
Created February 4, 2014 14:51
[korea language]
# 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"
@hunnycode
hunnycode / server.rb
Created February 13, 2014 07:13 — forked from bouzuya/server.rb
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>
<?php
header("content-type: text/xml");
// 発信者番号を取得します。
$tel_from = $_POST['From'];
// 録音ファイルのURLを取得します。
$recording_url = $_POST['RecordingUrl'];
?>
<Response>
<?PHP if (!empty($recording_url)): ?>
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Play>http://xxx.xxx.xxx.xxx/play/play.mp3</Play>
</Response>
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
# 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,
<?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'));
<?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',
<?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
<?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')
);