-1

这是我的代码。也许我有一个巨大的错误。但是,系统会将 API ID、消息 ID 和发送者放入数据库中自己的列表下。但是,现在无论我做什么,我都无法让它为消息文本设置回调。它似乎没有出现,我想知道在检索它时我哪里出错了。

非常感谢。毛里萨

<?php 

//database connection 

$hostname_sCONN = "localhost"; 
$database_sCONN = "XXXXXX";
$username_sCONN = "XXXXX";
$password_sCONN = "XXXXXX"; 
$sCONN = mysql_pconnect($hostname_sCONN, $username_sCONN, $password_sCONN) or trigger_error(mysql_error(),E_USER_ERROR); 



// Declare variables for url string 
//http://www.mysite.com/callback.php?api_id=xxx&apiMsgId=xxx&cliMsgId=xxx&status=xxx&timestamp=xxx&to=xxx&from=xxx&charge=xxx 


//this will pull the query part of the url i.e. api_id=xxx&apiMsgId=xxx&cliMsgId=xxx&status=xxx&timestamp=xxx&to=xxx&from=xxx&charge=xxx 
$url = $_SERVER['QUERY_STRING']; 


//retrieve contents of the url 
$api_id = $_GET['api_id']; 
$from = $_GET['from']; 
$to = $_GET['to']; 
$text = $_GET['text']; 
$dated = $_GET['timestamp']; 
$apiMsgId = trim($_GET['apiMsgId']); 
$status = $_GET['status']; 
$charge = $_GET['charge']; 




mysql_select_db($database_sCONN, $sCONN); 
$sql = "INSERT INTO tbl_messages (msgid, apiMsgId, sender, recipient, dated, message) VALUES ('$api_id', '$apiMsgId', '$from', '$to', '$dated', '$text')"; 
$result = mysql_query($sql, $sCONN) or die(mysql_error()); 

mysql_free_result($rsOutbox); 

mysql_select_db($database_sCONN, $sCONN); 
$sql2 = "SELECT value1 FROM fgusers3 WHERE mobile = '".$from."'"; 
$result2 = mysql_query($sql2, $sCONN) or die(mysql_error());
mysql_free_result($rsOutbox); 

$query4 = "SELECT * FROM `$user` ORDER BY id_user DESC 
                    LIMIT 1";

$result4 = mysql_query($query4);
$row4 = mysql_fetch_array($result4);
$balance = $row4['balance'];


$finalbalance = $result2 + $balance;

$sql3 = "INSERT INTO `$user` (`date`, `credit`, `balance`) VALUES ('$today', '$result2', '$finalbalance')"; 
$result3 = mysql_query($sql, $sCONN) or die(mysql_error());

?>
4

2 回答 2

0

如果您没有得到任何回应,这可能是问题。

A. 发送消息时未启用回调

示例(回调可以是 1、2 或 4 )

http://api.clickatell.com/http/sendmsg?session_id=xxx&to=xxxx&text=xxxx&callback=3

B. Clickatell 中未发送的回调 URL

C. Clickatell IP 锁定

D. 点击无法解析您的网址

请检查以上所有内容... var_dump 输出然后我们可以研究如何将其更新到您的 mysql 数据库

====== 电话银行信息 ========

0 没有返回消息状态。使用。002, 003, 011

2 仅返回消息的最终状态。004, 005, 006, 007, 008, 010, 012

3 返回消息的中间状态和最终状态。除 001 之外的所有状态

谢谢 :)

于 2012-03-27T17:41:55.947 回答
0

您必须捕获“文本”而不​​是“消息”,获取消息内容的关键字是文本。

于 2017-09-28T04:59:00.920 回答