1
我試圖建立一個小型應用程序,將傳入的電話號碼保存到數據庫,並有一個用戶界面,將允許管理員發送爆炸消息到數據庫中的數字。如果有人有這方面的經驗,我會喜歡一些關於如何完成這項任務的良好文檔或建議。如果可能?瞭解Twilio的功能。
我試圖建立一個小型應用程序,將傳入的電話號碼保存到數據庫,並有一個用戶界面,將允許管理員發送爆炸消息到數據庫中的數字。如果有人有這方面的經驗,我會喜歡一些關於如何完成這項任務的良好文檔或建議。如果可能?瞭解Twilio的功能。
下面是從我Twilio短信應用中的一些摘錄這可能給你的,你如何與Twilio互動感:
static const char * sms_host = "api.twilio.com";
static const char * sms_user = "AC(redacted)";
static const char * sms_pass = "(redacted)";
static const char * sms_from = "15155551212"; /* our purchased # */
static char * twilioSendTextUrl (
void
) {
return strBuild(NULL,
"https://%s:%[email protected]%s/2010-04-01/Accounts/%s/SMS/Messages",
sms_user, sms_pass, sms_host, sms_user);
}
static char * twilioSendTextRequest (
const char * to,
const char * text
) {
if ((to == NULL) || (text == NULL)) return NULL;
return strBuild(NULL,
"From=+%s" "&"
"To=+%s" "&"
"Body=%s",
sms_from,
to,
cgiEncode(text)
);
}
static char * doPost (
const char * url,
const char * postdata
) {
CURL * curl = curl_easy_init();
int ces;
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postdata);
...
ces = curl_easy_perform(curl);
curl_easy_cleanup(curl);
...
}
ret = doPost(twilioSendTextUrl(), twilioSendTextRequest(number, message));
嗨,約翰,來自Twilio的梅根來了。感謝您在StackOverflow社區提供幫助。我很想送你一件襯衫來表示感謝!電子郵件 - [email protected]。 –
Twilio具有良好的文檔。像這樣的事情很容易 - 你可能可以用shell腳本和命令行工具(如curl或wget)來做到這一點。示例文檔:https://www.twilio.com/docs/api/rest/making-calls –
請注意,您從Twilio「購買」的每個號碼最多可支持1個呼叫/秒 - 如果您需要更多峯值音量,你需要購買多個號碼。 –
我不確定你那個約翰是什麼意思?我很抱歉,我以前從未使用過Twilio。你認爲你可以更深入地解釋一下嗎? – Bitwise