<?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>';
$result = curl_exec($ch);
转载下一篇:字符串的加密和解密(C语言)
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章