2016-10-15 6 views
1

を使用してメッセージを送信しようとしたときにtwilioは、2時間のためにそれで働いて使用することはまだここ致命的なエラーtwilio

Fatal error: Uncaught exception 'Twilio\Exceptions\RestException' with message '[HTTP 400] Unable to create record' in /membri/deathcrow/server/sms/twilio-php-master/Twilio/Version.php:87 Stack trace: #0 /membri/deathcrow/server/sms/twilio-php-master/Twilio/Version.php(207): Twilio\Version->exception(Object(Twilio\Http\Response), 'Unable to creat...') #1 /membri/deathcrow/server/sms/twilio-php-master/Twilio/Rest/Api/V2010/Account/MessageList.php(63): Twilio\Version->create('POST', '/Accounts/ACa81...', Array, Array) #2 /membri/deathcrow/server/sms/que.php(25): Twilio\Rest\Api\V2010\Account\MessageList->create(Array) #3 {main} thrown in /membri/deathcrow/server/sms/twilio-php-master/Twilio/Version.php on line 87

をそれを把握するカントながら、私は、この致命的なエラーを得た私は隠されてきた私の完全なページの符号化ですセキュリティ上の理由から

<? 
require_once ("../connect.php"); 
require __DIR__ . '/twilio-php-master/Twilio/autoload.php'; 
use Twilio\Rest\Client; 
ignore_user_abort (true); 
$sql = "SELECT * FROM smsque ORDER BY id ASC LIMIT 1"; 
$query = mysql_query ($sql); 
$row = mysql_fetch_object ($query); 

$id = $row->id; 
$msg = $row->message; 
$amount = $row->amount; 
$reciever = $row->reciever; 

$headers = 'From: [email protected]'; 

// Your Account SID and Auth Token from twilio.com/console 
$sid = '******************'; 
$token = '*************'; 

$client = new Client($sid, $token); 
$client->account->messages->create(array(
    "From" => "**********", 
    "To" => "*******", 
    "Body" => "Test!")); 

    //mail ($to, '', $msg, $headers); 

$amount--; 

if ($amount >= 1){ 
    $sql2 = "UPDATE smsque SET amount='$amount' WHERE id='$id'"; 
    $query2 = mysql_query ($sql2); 
}else { 
    $sql2 = "DELETE from smsque WHERE id='$id'"; 
    $query2 = mysql_query ($sql2); 
} 
?> 

答えて

0

のSID、トークン、および数字は、あなたの関数呼び出しが正しくないようです。番号は「)(作成」の最初のパラメータである、だからあなたのコードは1

<? 
require_once ("../connect.php"); 
require __DIR__ . '/twilio-php-master/Twilio/autoload.php'; 
use Twilio\Rest\Client; 
ignore_user_abort (true); 
$sql = "SELECT * FROM smsque ORDER BY id ASC LIMIT 1"; 
$query = mysql_query ($sql); 
$row = mysql_fetch_object ($query); 

$id = $row->id; 
$msg = $row->message; 
$amount = $row->amount; 
$reciever = $row->reciever; 

$headers = 'From: [email protected]'; 

// Your Account SID and Auth Token from twilio.com/console 
$sid = '******************'; 
$token = '*************'; 

$client = new Client($sid, $token); 
$client->account->messages->create($reciever , 
     array(
       "From" => "**********", 
       "Body" => "Test!")); 

    //mail ($to, '', $msg, $headers); 

$amount--; 

if ($amount >= 1){ 
    $sql2 = "UPDATE smsque SET amount='$amount' WHERE id='$id'"; 
    $query2 = mysql_query ($sql2); 
}else { 
    $sql2 = "DELETE from smsque WHERE id='$id'"; 
    $query2 = mysql_query ($sql2); 
} 
?> 

以下のあなたのように実際にある必要があり、一般的なコール

$sms = $client->account->messages->create(

    // the number we are sending to - Any phone number 
    $number, 

    array(
     // Change the 'From' number below to be a valid Twilio number 
     // that you've purchased 
     'from' => "+**********", 
     // the sms body 
     'body' => "the sms body here " 
    ) 
); 

下に見る「こと」SMSを送信するにはもっと読むことができるhere