RELATEED CONSULTING
相关咨询
马上在线沟通
服务时间:8:30-18:00
你可能遇到了下面的问题
关闭右侧工具栏

技术支持

技术支持分类
短信接口之PHP接口
  • 作者:
  • 发表时间:2017-08-12 10:11
<?php //查询余额
$post_data = array();
$post_data['userid'] = 12;
$post_data['account'] = 'test';
$post_data['password'] = 'test';
$url='http://www.idlmar.com /sms.aspx?action=overage';
$o='';
foreach ($post_data as $k=>$v)
{
    $o.=urlencode("$k=".$v).'&';
}
$post_data=substr($o,0,-1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //如果需要将结果直接返回到变量里,那加上这句。
$result = curl_exec($ch);
?>
<?php //提交短信
$post_data = array();
$post_data['userid'] = 12;
$post_data['account'] = 'test';
$post_data['password'] = 'test';
$post_data['content'] = urlencode('测试php提交'); //短信内容需要用urlencode编码下
$post_data['mobile'] = 'X';
$post_data['sendtime'] = ''; //不定时发送,值为0,定时发送,输入格式YYYYMMDDHHmmss的日期值
$url='http://www.idlmar.com/sms.aspx?action=send';
$o='';
foreach ($post_data as $k=>$v)
{
   $o.="$k=".urlencode($v).'&';
}
$post_data=substr($o,0,-1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //如果需要将结果直接返回到变量里,那加上这句。
$result = curl_exec($ch);
?>
<?php //验证帐号
$post_data = array();
$post_data['userid'] = 12;
$post_data['account'] = 'test';
$post_data['password'] = 'test';
$url='http://客户端地址/sms.aspx?action=overage';
$o='';
foreach ($post_data as $k=>$v)
{
    $o.="$k=".urlencode($v).'&';
}
$post_data=substr($o,0,-1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //如果需要将结果直接返回到变量里,那加上这句。
$result = curl_exec($ch);
?>