<?php
 $post_data = array();
 $post_data['clientname'] = "test08";
 $post_data['clientpasswd'] = "test08";
 $post_data['submit'] = "submit";
 $url='http://127.0.0.1/myphp/top.php';
 $o="";
 foreach ($post_data as $k=>$v)
 {
     $o.= "$k=".urlencode($v)."&";
 }
 echo $o . '<hr>';
 $post_data=substr($o,0,-1);
 echo $post_data . '<hr>';
 $ch = curl_init();
 curl_setopt( $ch, CURLOPT_REFERER, "http://mail.sina.com.cn/index.html" );
 curl_setopt( $ch, CURLOPT_HEADER, true );
 curl_setopt( $ch, CURLOPT_POST, true );
 curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
 curl_setopt($ch, CURLOPT_URL,$url);
 //为了支持cookie
 curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
 curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
 $result = curl_exec($ch);
 echo $result;
 echo '<hr>';