模拟远程登录的实现代码

<?php $cookie_file =tempnam('./tem','cookie'); $login_url = 'http://bbs.php100.com/login.php'; $post_fields = 'cktime=3600&step=2&pwuser=6666666&pwpwd=555550'; $curl=curl_init($login_url); //      curl_setopt($curl,CURLOPT_URL,"http://www.baidu.com"); curl_setopt($curl,CURLOPT_HEADER,0); curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); curl_setopt($curl,CURLOPT_POST,1); curl_setopt($curl,CURLOPT_COOKIEJAR,$cookie_file); curl_setopt($curl,CURLOPT_POSTFIELDS,$post_fields); curl_exec($curl); curl_close($curl); //------------------------------------------------------------------------ $url='http://bbs.php100.com/index.php'; $ch=curl_init($url); curl_setopt($ch,CURLOPT_HEADER,0); curl_setopt($ch,CURLOPT_RETURNTRANSFER,0); curl_setopt($ch,CURLOPT_COOKIEFILE,$cookie_file); $contents= curl_exec($ch); curl_close($ch); ?>  
posted @ 2011-05-31 23:02  gxldan  阅读(180)  评论(0编辑  收藏  举报