<?php $CookieFile = tempnam("./tmep", "beast"); if (isset($_GET["img"])) { $url = 'http://www.phprm.com/'; //验证码code $ch = curl_init($url); curl_setopt($ch, CURLOPT_COOKIEJAR, $CookieFile); //把返回来的cookie信息保存在文件中 curl_exec($ch); curl_close($ch); exit(); } if (isset($_POST['d'])) { $b = $_POST[d]; //验证码 $p = "waybillNo=1721269381&inputcode=" . $b; $ch = curl_init(); // 2. 设置选项,包括URL curl_setopt($ch, CURLOPT_URL, "http://www.phprm.com"); curl_setopt($ch, CURLOPT_COOKIEJAR, $CookieFile); curl_setopt($ch, CURLOPT_COOKIEFILE, $CookieFile); //同时发送Cookie curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $p); //提交查询信息 $s = curl_exec($ch); curl_close($ch); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.phprm.com"); curl_setopt($ch, CURLOPT_COOKIEFILE, $CookieFile); //同时发送Cookie curl_setopt($ch, CURLOPT_COOKIEJAR, $CookieFile); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $p); //提交查询信息 $bs = curl_exec($ch); echo $bs; //输出结果 curl_close($ch); } else { ?> <form id="form1" name="form1" method="post" action=""> <img src="/static/imghwm/default1.png" data-src="?img=true" class="lazy" / alt="PHP利用curl获取验证码,发送cookie二次抓取 " ><!--由服务器端取图片内容并输出--> <input type="text" name="d" /> <input type="submit" name="button" id="button" value="提交" /> </form> <?php }
文章地址:
转载随意^^请带上本文地址!
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章
R.E.P.O.能量晶体解释及其做什么(黄色晶体)
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
3 周前By尊渡假赌尊渡假赌尊渡假赌
刺客信条阴影:贝壳谜语解决方案
1 周前ByDDD
R.E.P.O.如果您听不到任何人,如何修复音频
3 周前By尊渡假赌尊渡假赌尊渡假赌
在哪里可以找到原子中的起重机控制钥匙卡
1 周前ByDDD

热工具

Atom编辑器mac版下载
最流行的的开源编辑器

Dreamweaver Mac版
视觉化网页开发工具

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能