数据载入中,请稍后......
 
展开
懒人码库客户端 点击或扫描下载
欢迎来到懒人码库!懒人码库QQ群:19651313
欢迎来到懒人码库!懒人码库QQ群:19651313  
当前位置:懒人码库 > 服务端脚本 > PHP

PHP短信发送方法

2013-03-12 00:00 来源:懒人码库 / 作者:懒人码库 已被阅读:次 分类:PHP 上一篇:baidu 翻译API , 自动翻译写了一个函数,便于调用! 下一篇:php 部门测试题(仅供初学者参考)
<?php 
function Post($target,$sdst,$spwd,$data) { 
  
    if(!strlen($target)) return ''; 
     
     
    $data = "haoma=".trim($sdst)."&url=".$spwd."&Phone=".rawurlencode(trim($data)); 
    //var_dump($data); 
     
    $url_info = parse_url($target); 
    //var_dump($url_info); 
    //exit(); 
    $httpheader = "POST " . $url_info['path'] . " HTTP/1.0\r\n"; 
    $httpheader .= "Host:" . $url_info['host']. "\r\n"; 
    $httpheader .= "Content-Type:application/x-www-form-urlencoded\r\n"; 
    $httpheader .= "Content-Length:" . strlen($data) . "\r\n"; 
    $httpheader .= "Connection:close\r\n\r\n"; 
    //$httpheader .= "Connection:Keep-Alive\r\n\r\n"; 
    $httpheader .= $data; 
  
    $fd = fsockopen($url_info['host'], $url_info['port']?($url_info['port']):'80'); 
    fwrite($fd, $httpheader); 
    $gets = ""; 
    while(!feof($fd)) { 
        $gets .= fread($fd, 128); 
    } 
    fclose($fd); 
    return $gets; 
} 
//@Sy_dx_number  号码 
//@Sy_dx_pw  密码 
//@book_dxc  内容 
$dxre = Post('http://58.210.136.194:8800/sms/fssj.asp',$Sy_dx_number,$Sy_dx_pw,$book_dxc); 
?>

 

标签:
小贴士:懒人码库 为网页前端人员提供建站常用的广告代码和网页特效,内容涵盖焦点图,导航菜单,jQuery代码,图片特效,对联广告,日历控件,在线客服等。