1.windows平台:
$xhr = new COM("MSXML2.XMLHTTP");
$xhr->open("GET","http://localhost/xxx.php?id=2",false);
$xhr->send();
echo $xhr->responseText2.
<?php
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    $out = "GET / HTTP/1.1\r\n";
    $out .= "Host: www.example.com\r\n";
    $out .= "Connection: Close\r\n\r\n";    fwrite($fp, $out);
    while (!feof($fp)) {
        echo fgets($fp, 128);
    }
    fclose($fp);
}
?>

解决方案 »

  1.   

    我狂晕,这不是Ajax中的内容么?
      

  2.   

    就是想请教一下php中的Ajax
    xmlhttp是ajax的核心
    再请教一下,hookee() 仅给出了在win系统中的xmlhttp引用
    如果在linux下是能否引用呢?
      

  3.   

    xmlhttp无非就是get和put的操作。让你写的js可以自动获取服务器端的数据。在php干吗非要调用系统对象?简直多此一举
    在php里面
    get的,直接用file_get_contents/fopen/readfile这些函数就是了
    put的,自己写fsockopen发送也行,用NET_Curl也行
    又简单又通用,耗费资源又少。
      

  4.   

    get的,直接用file_get_contents/fopen/readfile这些函数就是了
    put的,自己写fsockopen发送也行,用NET_Curl也行 这些方法能POST参数 ,好像他们参数不 带这一项