2016-03-21 10 views
2

私はSMS Gateway PHP APIを使用したいと思いますが、使用するのに成功しません。私はSMSGATEWAY.MEのソフトウェアをAndroidの携帯電話にダウンロードしてアカウントを作成しました。無料のWebサーバーもあり、2つの文書をアップロードしました。SMSGATEWAY.ME - PHP APIの使い方は?

PHP APIライブラリ "smsGateway.php"

<?php 
include "smsGateway.php"; 
$smsGateway = new SmsGateway('my_email_on_their_website', 'my_password_for_this_account'); 

$deviceID = 111111; //the number of my device, displayed on their website or on the software installed on my phone 
$number = '+1234567891'; //the number I want to SMS 
$message = 'Hello World!'; //my message 

$options = [ 
    'send_at' => strtotime('+10 minutes'), // Send the message in 10 minutes 
    'expires_at' => strtotime('+1 hour') // Cancel the message in 1 hour if the message is not yet sent 
]; 

//Please note options is no required and can be left out 
$result = $smsGateway->sendMessageToNumber($number, $message, $deviceID, $options); 
?> 

しかし、私は私のブラウザhttp://mywwebsite.com/test.phpを訪問するとき、それはなぜしてください、あなたは知っています、SMSを送信しません: https://smsgateway.me/sms-api-libraries/sms-gateway-me-php.zip

私のファイル "test.phpを":ここで見つけますか?この問題を解決してもらえますか? (私の電話のゲートウェイはまだアクティブです)。

ありがとうございます!

敬具

+0

のように見えるのだろうか? – walkingRed

+0

私のプログラムの最後の行に "echo $ result"を追加してテストすると、画面に "致命的なエラー:クラス 'msGateway'が/srv/disk13/2087179/www/mywebsite.comに見つかりません/test.php on line 6 " – Olscream

+0

' smsGateway.php'ファイルが 'test.php'のディレクトリにあることを確認してください – walkingRed

答えて

0

あなたのコードが正しいです。あなたは結果が$result変数

echo json_encode($result); 

後に次の行を書き表示したい場合は、 `$のresult`値を提供できるよう、あなたのコードは、この

<?php 
    include "smsGateway.php"; 
    $smsGateway = new SmsGateway('my_email_on_their_website', 'my_password_for_this_account'); 

    $deviceID = 111111; //the number of my device, displayed on their website or on the software installed on my phone 
    $number = '+1234567891'; //the number I want to SMS 
    $message = 'Hello World!'; //my message 

    $options = [ 
     'send_at' => strtotime('+10 minutes'), // Send the message in 10 minutes 
     'expires_at' => strtotime('+1 hour') // Cancel the message in 1 hour if the message is not yet sent 
    ]; 

    //Please note options is no required and can be left out 
    $result = $smsGateway->sendMessageToNumber($number, $message, $deviceID, $options); 
echo json_encode($result); 
    ?> 
関連する問題