我想在表单提交后集成ang短信通知,在发送短信后,我想将其重定向到我的thankyou.html网页,这是我的代码:
<?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的新手,谢谢!
发布于 2015-07-11 13:42:33
为什么不在这里使用文件函数来检索api url的内容?
<?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.
  }
?>您可以看到收到的全部内容
print_r($dataArr);这是指向开发人员指南的链接。
https://stackoverflow.com/questions/31357224
复制相似问题