首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Clickatell -短信发送后重定向

Clickatell -短信发送后重定向
EN

Stack Overflow用户
提问于 2015-07-11 12:33:00
回答 1查看 719关注 0票数 2

我想在表单提交后集成ang短信通知,在发送短信后,我想将其重定向到我的thankyou.html网页,这是我的代码:

代码语言:javascript
运行
复制
<?php
if(isset($_POST['send'])){
$query="insert into table() values() ";
if(mysql_query($query)){
 header("location:http://api.clickatell.com/http/sendmsg?api_id=3549342&user=xxxx&password=xxxx&to=63926475xxxx&text=xxxx ");
}
}
?>
<form method=post >
Username: input type=text name=user >
Password: <input type=text name=pass >
Name: <input type=text name=name >
Mobile number: <input type=text name=mobile_no >
<input type=submit name=submit >
</form>

假设查询返回true,它将使用clickatell发送sms,如果消息成功,我希望它在显示“谢谢”的.html页面上重定向。

我是这个api的新手,谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-11 13:42:33

为什么不在这里使用文件函数来检索api url的内容?

代码语言:javascript
运行
复制
<?php
  $url = "http://api.clickatell.com/http/sendmsg?api_id=3549342&user=xxxx&password=xxxx&to=63926475xxxx&text=xxxx";

  $data = file($url);

  $dataArr = explode(":",$data[0]);

  if ($dataArr[0] == "OK") 
  {
    //do the redirection here
    header("location:your.html");
    exit;
  } 
  else 
  {
    echo "Failed: ".$dataArr[1]; //apparently $dataArr[0] contains 'ERR' and has no details regarding the error.
  }
?>

您可以看到收到的全部内容

代码语言:javascript
运行
复制
print_r($dataArr);

这是指向开发人员指南的链接。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31357224

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档