【发布时间】:2017-11-29 13:21:45
【问题描述】:
<?php
error_reporting(E_ALL ^ E_NOTICE);ini_set('error_reporting', E_ALL ^ E_NOTICE);
define('IS_ADMIN_FLAG', false);
include_once(dirname(__FILE__).'/../../config/config.inc.php');
include_once(dirname(__FILE__).'/../../config/setting.inc.php');
include_once('includes/model/smsAdapter.php');
include_once('includes/model/sms.php');
include_once('includes/model/variables.php');
class ControllerSmsApi
{
public function __construct()
{
$this->index();
}
public function index()
{
die("DISABLED");
$to = $this->getVar("to");
$text = $this->getVar("text");
$unicode = $this->getVar("unicode");
$type = $this->getVar("type");
$transaction = $this->getVar("transaction");
if(isset($to) && strlen($to) > 4 && strlen($text) > 0)
{
$sms = new SmsModel(true, SmsModel::TYPE_SIMPLE, $type, ($transaction ? SmsModel::SMS_TRANSACTION : SmsModel::SMS_BULK));
$sms->number($to)->text($text)->unicode($unicode)->send();
if(!$sms->isError())
{
echo "SMSSTATUS:OK";
}
else
{
echo "SMSSTATUS:ERROR";
}
}
else
{
echo "SMSSTATUS:ERROR";
}
}
private function getVar($var)
{
if(filter_input(INPUT_POST, $var))
{
return filter_input(INPUT_POST, $var);
}
elseif(filter_input(INPUT_GET, $var))
{
return filter_input(INPUT_GET, $var);
}
else
{
return null;
}
}
}
new ControllerSmsApi();
?>
我有一个电子商务网站,客户在该网站下订单并通过电子邮件服务获取所有更新,但现在我想将其用于短信服务,为此我在 msg91 中为 php 提供了短信 API。但不幸的是,我无法通过 prestasms 或任何其他免费模块将它与 prestashop 集成。
【问题讨论】:
-
在寻求帮助之前向我们展示一些工作:)
-
这是一个与您的短信提供商兼容的模块:addons.prestashop.com/fr/emails-notifications/…
-
我说的是免费模块
-
那我说,让我们看看你到目前为止做了什么。
-
它在本地主机上,我怎么给你看? Prestasms 文件?或任何特定代码?实际上我想在订单状态发生变化时发送短信,我不了解 prestashop 核心文件来执行此操作。并且没有任何东西可以在互联网上提供这些信息。
标签: php api sms prestashop sms-gateway