1
msg7086 2015-09-16 00:53:33 +08:00
Talk is cheap, show me the code.
|
2
eoo OP @msg7086
<?php header ("Content-type: text/html; charset=utf-8"); ini_set ('display_errors','on'); error_reporting (E_ALL ); //限制内存占用 ini_set ('memory_limit','10M'); //普通 URL 地址 $url="http://xin123.cc/bbs/book_list.aspx?action=new&siteid=1000"; //签到地址 $qd_url="http://xin123.cc/signin/Signin.aspx?Action=index&Mod=Signin&siteid=1000"; //COOKIE $cookie = 'sidxin123=6C24EE628EF9AF160_8_68_37964_500100-2-0-0-0-600 '; $data="content=月饼&FaceSelect=1.gif&g=签到"; $ch = curl_init (); curl_setopt ($ch,CURLOPT_URL,$qd_url ); curl_setopt ($ch,CURLOPT_HEADER,false ); //curl_setopt ($ch,CURLOPT_TIMEOUT,2 ); $header = array ( "Content-length: ".strlen ($data )." ); curl_setopt ($ch,CURLOPT_HTTPHEADER,$header ); curl_setopt ($ch,CURLOPT_POST,true ); curl_setopt ($ch,CURLOPT_POSTFIELDS,$data ); curl_setopt ($ch,CURLOPT_COOKIE,$cookie ); curl_setopt ($ch,CURLOPT_RETURNTRANSFER,false ); curl_exec ($ch ); curl_close ($ch ); |
3
msg7086 2015-09-16 03:04:17 +08:00
<?php
header ("Content-type: text/html; charset=utf-8"); ini_set ('display_errors','on'); error_reporting (E_ALL ); ini_set ('memory_limit','10M'); $url="http://xin123.cc/bbs/book_list.aspx?action=new&siteid=1000"; $qd_url="http://xin123.cc/signin/Signin.aspx?Action=index&Mod=Signin&siteid=1000"; $cookie = 'sidxin123=6C24EE628EF9AF160_8_68_37964_500100-2-0-0-0-600'; $data="content=月饼&FaceSelect=1.gif&g=签到"; $ch = curl_init (); curl_setopt ($ch,CURLOPT_URL,$qd_url ); curl_setopt ($ch,CURLOPT_HEADER,true ); curl_setopt ($ch,CURLOPT_POST,true ); curl_setopt ($ch,CURLOPT_POSTFIELDS,$data ); curl_setopt ($ch,CURLOPT_COOKIE,$cookie ); curl_setopt ($ch,CURLOPT_RETURNTRANSFER,false ); curl_exec ($ch ); curl_close ($ch ); 以上代码测试得到 HTTP/1.1 200 OK Cache-Control: no-cache Pragma: no-cache Content-Length: 11900 Content-Type: text/html; charset=utf-8 Expires: -1 Server: Microsoft-IIS/8.0 X-AspNet-Version: 2.0.50727 Set-Cookie: ASP.NET_SessionId=wk1vytudkv1azf55vjd5cbnj; path=/; HttpOnly Set-Cookie: GUID=409df51603005952; expires=Thu, 15-Sep-2016 19:00:59 GMT; path=/ X-Powered-By: ASP.NET Date: Tue, 15 Sep 2015 19:00:59 GMT (内容略) 于是问题在哪? |