温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

http+socket发送短信

发布时间:2020-04-03 08:04:15 来源:网络 阅读:311 作者:hgditren 栏目:开发技术
public  function Post($data, $target) {
   $url_info = parse_url($target);
   $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'], 80);
   fwrite($fd, $httpheader);
   $gets = "";
   while(!feof($fd)) {
       $gets .= fread($fd, 128);
   }
   fclose($fd);
   if($gets != ''){
       $start = strpos($gets, '<?xml');
       if($start > 0) {
           $gets = substr($gets, $start);
       }
   }
   return $gets;
}


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI