CURL抓取的网页中,通过相对路径引用了其他页面,如何解决cookie问题? curl相对路径cookie 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 分两次/多次抓取其实对于ajax/验证码等等都是这样做的 header("Content-type:text/html;charset=utf-8"); function request_by_curl($remote_server, $post_string) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $remote_server); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_NOBODY, false); curl_setopt($ch, CURLOPT_HEADER,true); curl_setopt($ch, CURLOPT_HTTPHEADER, array()); $data = curl_exec($ch); curl_close($ch); return $data; } //获取验证码 file_get_contents("http://jysx.scnu.edu.cn/VerifyImg.aspx"); $cookie = $http_response_header[6]; $code = substr($cookie,23,4); echo $code."<br>"; //post登录 $remote_server = "http://jysx.scnu.edu.cn/login.aspx"; $post_string = 'act=login&type=ajax&name=20102301025&pass=523523&verify='.$code; echo request_by_curl($remote_server,$post_string);这是我模拟登录华南师范大学抢实习的php代码,好像不行啊 博客搬家思路 php乱码问题 php exec的问题 怎样查询到日期最新的那条记录? php4.3.6调用win32api? 今天用了PHPDoc不错!(我现在是0分,这几天好象没有加分似的) 2003下IIS+php4.2.3。配置gd库出现如下问题! 谁能救救我,帮我调试一段程序,100分都给你. 从网上得一个登陆程序,我想把它作来,可没成功,并引出了一些疑问(用号标出)请给解释以下 javascirpt+php怎样才能将数组值插入到表中去。 include_path='.:/usr/share/php:/usr/share/pear' php 查询 不能输出结果
其实对于ajax/验证码等等都是这样做的
function request_by_curl($remote_server, $post_string)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $remote_server);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_HEADER,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array());
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
//获取验证码
file_get_contents("http://jysx.scnu.edu.cn/VerifyImg.aspx");
$cookie = $http_response_header[6];
$code = substr($cookie,23,4);
echo $code."<br>";
//post登录
$remote_server = "http://jysx.scnu.edu.cn/login.aspx";
$post_string = 'act=login&type=ajax&name=20102301025&pass=523523&verify='.$code;
echo request_by_curl($remote_server,$post_string);这是我模拟登录华南师范大学抢实习的php代码,好像不行啊