//$url 异步地址 //$data 请求数据 function Fsockopen_Post($url, $data = '') { $row = parse_MyUrl($url); $host = $row['host']; $port = isset($row['port']) ? $row['port'] : 80; $file = $row['path']; $post = ''; while (list($k,$v) = each($data)) { if(isset($k) && isset($v)) $post .= rawurlencode($k)."=".rawurlencode($v)."&"; //转URL标准码 } $post = substr( $post , 0 , -1 ); $len = strlen($post); $fp = @fsockopen( $host ,$port, $errno, $errstr, 10); if (!$fp) { return "$errstr ($errno) "; } else { $receive = ''; $out = "POST $file HTTP/1.0 "; $out .= "Host: $host "; $out .= "Content-type: application/x-www-form-urlencoded "; $out .= "Connection: Close "; $out .= "Content-Length: $len "; $out .= $post; fwrite($fp, $out); while (!feof($fp)) { $receive .= fgets($fp, 128); } fclose($fp); $receive = explode(" ",$receive); unset($receive[0]); return implode("",$receive); } }