-2
應用程序使用REST API發送消息,但是按照原樣,「to」號碼被硬編碼到應用程序中。我希望這個號碼是用戶輸入的值。在Ruby中接收電話號碼輸入
HTML:
<!DOCTYPE html>
<head>
<title>Joe's Web App</title>
<link rel="stylesheet" type="text/css" href="index.css" media="screen"/>
</head>
<body>
<div class="content">
<div class="words">
<h1>My Name</h1>
<p>
Insert your number below to recieve a text!
</p>
</div>
<input type="tel" placeholder="Phone Number" name="number">
<input type="submit">
</div>
</body>
紅寶石:
require 'rubygems'
require 'twilio-ruby'
account_sid = 'AC26b29f734e8145f6df3497eb6ca50205'
auth_token = 'my auth token'
@client = Twilio::REST::Client.new account_sid, auth_token
@client.account.messages.create({
:from => 'Twilio Number',
:to => 'phone number',
:body => 'Hey this is Joe!',
})
我認爲,如果你建立與機架這將是簡單的。更多細節.. https://codenoble.com/blog/ruby-web-applications-without-rails/ –
所以你的意思是,你想在sinatra中實現這個或者什麼? – marmeladze
歡迎來到Stack Overflow。這並不完全清楚你想要什麼。 –