把xml循环到数组里然后post数组不可能直接post xml或者你post一个xml地址,接受到后,去读xml

解决方案 »

  1.   

    谢谢楼上的朋友 本人真的不会PHP 希望获得原码!!
      

  2.   

    假设要POST的地址是 http://www.xxx.com/xxx.aaa$post = <<<DOC
    <?xml version="1.0" encoding="UTF-8"?>
    <test>
    This is a XML.
    </test>DOC;$http_header = "";
    $http_header .= "POST /xxx.aaa HTTP/1.1\r\n";
    $http_header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $http_header .= "Host: www.xxx.com\r\n";
    $http_header .= "Content-Length: ".strlen($post)."\r\n";
    $http_header .= "Connection: Keep-Alive\r\n";
    $http_header .= "Cache-Control: no-cache\r\n";
    $http_header .= "\r\n";$fp = @fsockopen("www.xxx.com", 80, $errno, $errstr, 30);
    if (!$fp)
    {
    //---- 连不上 ----
    exit;
    }
    fwrite($fp, $http_header);
    fwrite($fp, $post);
    echo fgets($fp, 1280);
    fclose($fp);
      

  3.   

    假设要POST的地址是 http://www.xxx.com/xxx.aaa$post = <<<DOC
    <?xml version="1.0" encoding="UTF-8"?>
    <test>
    This is a XML.
    </test>DOC;$http_header = "";
    $http_header .= "POST /xxx.aaa HTTP/1.1\r\n";
    $http_header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $http_header .= "Host: www.xxx.com\r\n";
    $http_header .= "Content-Length: ".strlen($post)."\r\n";
    $http_header .= "Connection: Keep-Alive\r\n";
    $http_header .= "Cache-Control: no-cache\r\n";
    $http_header .= "\r\n";$fp = @fsockopen("www.xxx.com", 80, $errno, $errstr, 30);
    if (!$fp)
    {
    //---- 连不上 ----
    exit;
    }
    fwrite($fp, $http_header);
    fwrite($fp, $post);
    echo fgets($fp, 1280);
    fclose($fp);