高手指点:如何登陆到https,并将cookie发送过去 标记。只知道Apchache要启动https服务。form 提交到 https://url行不行? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我在网上找了几个类是的登陆程序,可是浏览器没有任何反映,我不知道是不是能用,我必须要登陆进去才行<?# script by Joel De Gan# http://listbid.comfunction GetCurlPage ($pageSpec) {//$agent = "up.b";//$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";$header[] = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*";$ch = curl_init($pageSpec);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_VERBOSE, 1); ########### debugcurl_setopt($ch, CURLOPT_USERAGENT, $agent);curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($ch, CURLOPT_COOKIEJAR, "cook");curl_setopt($ch, CURLOPT_COOKIEFILE, "cook");$tmp = curl_exec ($ch);curl_close ($ch);return $tmp;}function PostCurlPage ($pageSpec, $data){ $agent = "up.b"; $header[] = "Accept: text/vnd.wap.wml,*.*"; $ch = curl_init($pageSpec); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); ########### debug curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt ($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, "cook"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cook"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $tmp = curl_exec ($ch); curl_close ($ch); return $tmp;}//$first = GetCurlPage("https://www.paypal.com/cgi-bin/phscr?cmd=login"); $first = GetCurlPage("https://www.paypal.com");$exp = explode("=", $first);$id = explode("\"", $exp[16]);//$second = PostCurlPage("https://www.paypal.com/cgi-bin/phscr?rs=".$id[0], "[email protected]&pass=YOUR_PP_PASS&cmd=login-submit-pass");//echo $second."\n\n";?> 你在传递COOKIE时标记secure参数了吗?int SetCookie(string name, string value, int expire, string path, string domain, int secure); 除了name之外所有的参数都是可选的。value,path,domain三个参数可以用空字符串代换,表示没有设置;expire 和 secure两个参数是数值型的,可以用0表示。expire参数是一个标准的Unix时间标记,可以用time()或mktime()函数取得,以秒为单位。secure参数表示这个Cookie是否通过加密的HTTPS协议在网络上传输。 php 为什么喜欢用 thread-xxx-xx.php 为名? mod_rewrite 用法 ByteRun Protector for PHP decode 解码问题,大家一起来研究一下! 什么情况下,apache会出现这种错误 如何做两个下拉框想关联? 刚刚写了一个函数,怎么会这样啊?大家帮忙瞧一下吧. php 模拟请求 页面跳转问题 smarttemplate与smarty有没有区别??希望知道的跟贴~~~~~~~~~ 如何让apache能支持中文啊 PHP程序员可以使用J2EE技术了 请高手指点 寻求合作者开发一套网络论坛,有兴趣的朋友进来看一下
我不知道是不是能用,我必须要登陆进去才行
<?
# script by Joel De Gan
# http://listbid.comfunction GetCurlPage ($pageSpec) {//$agent = "up.b";
//$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$header[] = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*";
$ch = curl_init($pageSpec);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1); ########### debug
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cook");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cook");
$tmp = curl_exec ($ch);
curl_close ($ch);
return $tmp;
}
function PostCurlPage ($pageSpec, $data)
{
$agent = "up.b";
$header[] = "Accept: text/vnd.wap.wml,*.*";
$ch = curl_init($pageSpec);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1); ########### debug
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cook");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cook");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$tmp = curl_exec ($ch);
curl_close ($ch);
return $tmp;
}//$first = GetCurlPage("https://www.paypal.com/cgi-bin/phscr?cmd=login");
$first = GetCurlPage("https://www.paypal.com");
$exp = explode("=", $first);
$id = explode("\"", $exp[16]);
//$second = PostCurlPage("https://www.paypal.com/cgi-bin/phscr?rs=".$id[0], "[email protected]&pass=YOUR_PP_PASS&cmd=login-submit-pass");
//echo $second."\n\n";
?>
除了name之外所有的参数都是可选的。value,path,domain三个参数可以用空字符串代换,表示没有设置;expire 和 secure两个参数是数值型的,可以用0表示。expire参数是一个标准的Unix时间标记,可以用time()或mktime()函数取得,以秒为单位。secure参数表示这个Cookie是否通过加密的HTTPS协议在网络上传输。