• 技术文章 >php教程 >php手册

    PHP源码学习:探测httpheader头

    2016-06-21 08:58:37原创846
    program : Spr2[detect_httpheader]
    Author : uchinaboy
    E-mail : uchinaboy@163.com
    QQ : 16863798
    Date : 2001-7-25
    ****************************************************/
    $host = "www.infojet.com.cn";
    $port = "80"; $path = "/yuhu/";
    $filename = "talk0.asp";
    $datestream = "sdjahsdjkhaksjd";
    $length = strlen($datestream);
    $header = "POST ${ path}$filename HTTP/1.1\n";
    $header.= "HOST: $host\n";
    $header.= "Content-Type: application/x-www-form-urlencoded\n";
    $header.= "Content-Length: $length\n\n";
    $header.= "$datestream";
    function sock() { global $host, $port, $header;
    $fsocket = @fsockopen($host, $port, &$errno, &$errstr);
    if(!$fsocket) { echo "$errstr ($errno)\n"; }else { fputs($fsocket, $header);
    while(!feof($fsocket)) {
    $res = fread($fsocket, 128);
    echo $res; }
    }
    fclose($fsocket);
    }
    set_time_limit(0);
    sock();
    ?>



    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    上一篇:初学PHP的18个基础例程 下一篇:自己动手写 PHP MVC 框架(40节精讲/巨细/新人进阶必看)

    相关文章推荐

    • php利用新浪接口查询ip获取地理位置• php mysql 数据库类• PHP代码:Http断点续传的实现例子• 如何获知PHP程序占用多少内存(memory_get_usage)• PHP Memcached应用实现代码
    1/1

    PHP中文网