z.php
$ar = array('name' => '你想', 'pass' => 'mmmm'); 
foreach($ar as $key => $value){
    $params.= '&'.$key . '=' . $value;
}
$header="POST /test/zz.php HTTP/1.1\r\n";
$header.="Host:\r\n";
$header.="Referer: /test/zz.php \r\n";
$header.="Content-Type: application/x-www-form-urlencoded\r\n";
$header.="Content-Length: ".strlen($params)."\r\n";
$header.="Connection: Close\r\n\r\n"; 
$header.=$params;
$fp=fsockopen('localhost','80');
fputs($fp,$header);
怎么不跳到zz.php去?

解决方案 »

  1.   

    $XPost = '<xml>....</xml>';
    $url = 'zz.php'
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);      // set url to post to
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);      // return into a variable
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);      // times out 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $XPost);     // add POST fields
    $result = curl_exec($ch);lz可以试试这个
      

  2.   

    不支持curl_init(),有没有其他办法?