function get($url)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT,10);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
//打开呀里妈妈登陆页面
$url="http://www.alimama.com/member/minilogin.htm";
$add = get($url);//得到页面中的一个随机值
preg_match("/<input name='_tb_token_' type='hidden' value='(.*)'>/isU",$add,$cadd);
#echo $cadd[1];
$cookie = dirname(__FILE__).'/cookie1.txt';
$surl='http://www.alimama.com/member/minilogin_act.htm';
$curlPost = "_tb_token_=".$cadd[1]." & logname=************* & logpasswd=********* & originalLogpasswd=********** & proxy=http://www.alimama.com/proxy.htm & redirect='' & style='' ";
$ch = curl_init($surl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_exec($ch);
curl_close($ch);求助 提交的数据有问题还是? 获取不到正确的cookie.
http://www.alimama.com/member/minilogin.htmalimamacurlcookieurl
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT,10);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
//打开呀里妈妈登陆页面
$url="http://www.alimama.com/member/minilogin.htm";
$add = get($url);//得到页面中的一个随机值
preg_match("/<input name='_tb_token_' type='hidden' value='(.*)'>/isU",$add,$cadd);
#echo $cadd[1];
$cookie = dirname(__FILE__).'/cookie1.txt';
$surl='http://www.alimama.com/member/minilogin_act.htm';
$curlPost = "_tb_token_=".$cadd[1]." & logname=************* & logpasswd=********* & originalLogpasswd=********** & proxy=http://www.alimama.com/proxy.htm & redirect='' & style='' ";
$ch = curl_init($surl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_exec($ch);
curl_close($ch);求助 提交的数据有问题还是? 获取不到正确的cookie.
http://www.alimama.com/member/minilogin.htmalimamacurlcookieurl
解决方案 »
- 谁有IESTORE的GSPAY支付模块?200分!
- 关于linux下php、apache、mysql的相关配置。。。。
- 学习STMP发送邮件时形成了一个认识--认为fsockopen/fwrite/fread读写的指令可以通过都可以直接在telnet中使用,请大家看看这段代码
- PHP如何获取xml中的信息??
- php zip扩展问题
- 亲,帮个忙呗
- 请教,php中判断数组不为空!以下代码,应该如何判断!
- snoopy获取微信分享链接页面的问题
- 数组处理 a:2:{i:0;s:10:"11月25日";i:1;s:0:"你好";}
- 帝国cms 无法上传图片
- thinkphp url重写 怎么隐藏模块名和操作名,正则怎么写?
- ubuntu下php编译问题,求助,路过的请贴~
<input type="hidden" name="style" value="" />
<input type="hidden" name="redirect" value="" />
<input type="hidden" name="proxy" value="" />
后3个不提交是否可以?如果可以,他要他们做什么?print_r(get_headers('http://www.alimama.com/member/minilogin.htm'));Array
(
[0] => HTTP/1.1 200 OK
[1] => Server: Tengine
[2] => Date: Fri, 18 Oct 2013 01:24:51 GMT
[3] => Content-Type: text/html;charset=UTF-8
[4] => Connection: close
[5] => Vary: Accept-Encoding
[6] => Set-Cookie: cookie2=e06642156d5ce9afdaea41ce9294cae3;Domain=.alimama.com;Path=/;HttpOnly
[7] => Set-Cookie: _tb_token_=6OWE4tYt9fm;Domain=.alimama.com;Path=/;HttpOnly
[8] => Set-Cookie: t=b9e8101e83a7e0f0cafdd6296abb05a4; Domain=.alimama.com; Expires=Tue, 18-Jul-2023 02:04:51 GMT; Path=/
[9] => Set-Cookie: v=0; Domain=.alimama.com; Path=/
[10] => Content-Language: zh-CN
[11] => Expires: Fri, 18 Oct 2013 01:24:51 GMT
[12] => Cache-Control: max-age=0
)
这几个 cookie 你也没有提交
CURLOPT_COOKIEFILE 是发送 cookie 文件(通常是上面取回的)