2
我想使用SMS网关PHP API,但我没有成功使用它。我用手机从SMSGATEWAY.ME下载了我的手机软件,并且我创建了一个帐户。我也有一个免费的网络服务器,我上传了两个文件:SMSGATEWAY.ME - 如何使用PHP API?
他们的PHP API库“smsGateway.php”在这里找到: https://smsgateway.me/sms-api-libraries/sms-gateway-me-php.zip
我的文件“test.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,不发短信,你知道为什么吗?你能帮我解决这个问题吗? (我手机上的网关仍处于活动状态)。
预先感谢您!
致以问候
你能否提供'$ result'价值? – walkingRed
当我在程序的最后一行添加“echo $ result”并对其进行测试时,它会在屏幕上显示:“致命错误:Class'msGateway'在/srv/disk13/2087179/www/mywebsite.com中找不到/test.php第6行“ – Olscream
确保'smsGateway.php'文件在test.php目录下 – walkingRed