2
我正在創建一個PHP網站我試圖在用戶在網站上輸入電話號碼時使用Twilio發送消息。目前它只發送一條消息給我在我的代碼中寫的數字。我怎樣才能發送到輸入的號碼?Twilio從網站向多個用戶發送短信
<?php
require('Twilio.php');
// ==== Control Vars =======
$strFromNumber = "";
$strToNumber = "";
$strMsg = "Hey!! ";
$aryResponse = array();
// set our AccountSid and AuthToken - from www.twilio.com/user/account
$AccountSid = "";
$AuthToken = "";
// ini a new Twilio Rest Client
$objConnection = new Services_Twilio($AccountSid, $AuthToken);
// Send a new outgoinging SMS by POSTing to the SMS resource
$bSuccess = $objConnection->account->sms_messages->create(
$strFromNumber, // number we are sending from
$strToNumber, // number we are sending to
$strMsg // the sms body
);
$aryResponse["SentMsg"] = $strMsg;
$aryResponse["Success"] = true;
echo json_encode($aryResponse);
?>
$ strToNumber =「$ _POST [」cellphone「];」;喜歡這個? –
@AadeshShah我不做PHP,但'$ strToNumber = $ _POST [「number」];'應該工作。不需要使用引號來包圍代碼。 –
感謝男人它工作非常讚賞 –