网上找了一段代码,供你参考:http://www.diybl.com/course/4_webprogram/php/phpshil/2007828/69907.html
<?php
set_time_limit(0);
$use_proxy=1;
//###############
$proxy_host="62.150.76.251";
$proxy_port="80";
//###############
$file="http://search.blog.sina.com.cn/blog/search";
$data="q=".rawurlencode("苏南 电脑")."&tag=n&s=0&t=author";
$method="post";
$sock_time_limit=60;
//###############
$file_arr=parse_url($file);
$file_host=$file_arr["host"];
if (array_key_exists("port",$file_arr)){
        $file_port=($file_arr["port"]=="")?(80):($file_arr["port"]);
}
else{
        $file_port=80;
}
$file_host_4_http=$file_host.":".$file_port;
$file_host_4_http=$file_host;
$file_url_4_http=$file."?".$data;
//###############
if ($use_proxy==1){
        $host=$proxy_host;
        $port=$proxy_port;
        $connection_str="Proxy-Connection";
}
else{
        $host=$file_host;
        $port=$file_port;
        $connection_str="Connection";
}
$base_meta="Host: ".$file_host_4_http."\r\n";
$base_meta.="Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*\r\n";$base_meta.="Referer:http://blog.sina.com.cn/newsn\r\n";
$base_meta.="Accept-Language: zh-cn\r\n";
$base_meta.="Accept-Encoding: deflate\r\n";
$base_meta.="User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)\r\n";
$base_meta.= $connection_str.": Close\r\n";
switch($method){
        case "head":
                $out = "HEAD ".$file_url_4_http." HTTP/1.1\r\n";
                $out .= $base_meta;
                $out .= "\r\n\r\n";
                break;
        case "post":
                $out = "POST ".$file." HTTP/1.1\r\n";
                $out .= $base_meta;
                $out .= "Content-Type: application/x-www-form-urlencoded\r\n";
                $out .= "Content-Length: ". strlen($data) . "\r\n\r\n";
                $out .= $data."\r\n";
                break;
        case "get":
                $out = "GET ".$file_url_4_http." HTTP/1.1\r\n";
                $out .= $base_meta;
                $out .= "\r\n\r\n";
                break;
        default:
                break;
}
$fp = fsockopen($host, $port, $error, $errstr, $sock_time_limit);
if (!$fp) {
   echo "$errstr ($error)<br />n";
} else {
   fwrite($fp, $out);
   while (!feof($fp)) {
       echo fgets($fp, 128);
   }
   fclose($fp);
}
?>