Home  >  Article  >  php教程  >  php短信接口例子

php短信接口例子

PHP中文网
PHP中文网Original
2016-05-22 17:22:311091browse

php代码

<?php
include_once(&#39;sms.php&#39;);

$target = "http://dc.28inter.com/sms.aspx";
//替换成自己的测试账号,参数顺序和wenservice对应
$post_data = "action=send&userid=&account=账号&password=密码&mobile=手机号&sendTime=&content=".rawurlencode("程序调试请测试平时需要发送的内容");
//$binarydata = pack("A", $post_data);
$gets = Post($post_data, $target);
$start=strpos($gets,"<?xml");
$data=substr($gets,$start);
$xml=simplexml_load_string($data);
var_dump(json_decode(json_encode($xml),TRUE));
//请自己解析$gets字符串并实现自己的逻辑
//0表示成功,其它的参考文档
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn