$username = "info@example.com";
$hash = "*******************************************";
$test = "0";
$sender = "php sender";
$numbers = "7575757577";
$message = "verification code";
$message = urlencode($message);
$data = "username=".$username."&hash=".$hash."&message=".$message."&sender=".$sender."&numbers=".$numbers."&test=".$test;
$ch = curl_init('http://api.textlocal.in/send/?');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
echo"<pre>";
print_r($result);exit;
我正在使用CodeIgniter实施免费的SMS API。现在的问题是,当我单击“提交”按钮时,它会引发如下所述的错误
{"errors":[{"code":3,"message":"Invalid login details"}],"status":"failure"}
我不知道为什么会引发此错误。如何使用CodeIgniter来实现呢?我还在curl
文件中加载了autoload
库。请帮助我。
谢谢
答案 0 :(得分:0)
我在api documentation的textlocal。中找到了一个php类。下载该文件并将其上传到您的站点。这是下载链接; click。
然后只需使用此简单代码发送短信;
require 'textlocal.class.php';
$textlocal=new textlocal('me@textlocal.in','e215398a8820abd2c7a11a6cd5b1009d'); // email and hash
$textlocal->sendSms(['917788990011'],'Your car - KA01 HG 9999 - is due for service on July 24th, please text SERVICE to 92205 92205 for a callback','FORDIN'); // First target phone number, then the message, and then where the sms comes from
(从此处获取代码; click) 如果您还有其他疑问,请问:)