php使用curl模拟登录discuz以及模拟发帖
http://www.361way.com/curl-zhuaqu/1482.html
<?php
login_url = post_fields = array();
//以下两项不需要修改
post_fields['loginsubmit'] = 'true';
//用户名和密码,必须填写
post_fields['password'] = '111111';
//安全提问
post_fields['answer'] = '';
//@todo验证码
ch = curl_init(ch, CURLOPT_HEADER, 0);
curl_setopt(contents = curl_exec(ch);
preg_match('//i', matches);
if(!empty(cookie_file = tempnam('./temp','cookie');
login_url);
curl_setopt(ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt(ch, CURLOPT_POSTFIELDS, ch, CURLOPT_COOKIEJAR, ch);
curl_close(send_url = ch = curl_init(ch, CURLOPT_HEADER, 0);
curl_setopt(ch, CURLOPT_COOKIEFILE, contents = curl_exec(ch);
//这里的hash码和登陆窗口的hash码的正则不太一样,这里的hidden多了一个id属性
preg_match('//i', matches);
if(!empty(post_data = array();
//帖子标题
post_data['message'] = 'test2';
post_data['extra'] = '';
//帖子标签
post_data['formhash']=ch = curl_init(ch, CURLOPT_REFERER, ch, CURLOPT_HEADER, 0);
curl_setopt(ch, CURLOPT_COOKIEFILE, ch, CURLOPT_POST, 1);
curl_setopt(post_data);
ch);
curl_close(cookie_file);
?>
阅读(511) | 评论(0) | 转发(0) |
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
<?php
login_url = post_fields = array();
//以下两项不需要修改
post_fields['loginsubmit'] = 'true';
//用户名和密码,必须填写
post_fields['password'] = '111111';
//安全提问
post_fields['answer'] = '';
//@todo验证码
ch = curl_init(ch, CURLOPT_HEADER, 0);
curl_setopt(contents = curl_exec(ch);
preg_match('//i', matches);
if(!empty(cookie_file = tempnam('./temp','cookie');
login_url);
curl_setopt(ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt(ch, CURLOPT_POSTFIELDS, ch, CURLOPT_COOKIEJAR, ch);
curl_close(send_url = ch = curl_init(ch, CURLOPT_HEADER, 0);
curl_setopt(ch, CURLOPT_COOKIEFILE, contents = curl_exec(ch);
//这里的hash码和登陆窗口的hash码的正则不太一样,这里的hidden多了一个id属性
preg_match('//i', matches);
if(!empty(post_data = array();
//帖子标题
post_data['message'] = 'test2';
post_data['extra'] = '';
//帖子标签
post_data['formhash']=ch = curl_init(ch, CURLOPT_REFERER, ch, CURLOPT_HEADER, 0);
curl_setopt(ch, CURLOPT_COOKIEFILE, ch, CURLOPT_POST, 1);
curl_setopt(post_data);
ch);
curl_close(cookie_file);
?>
相关热门文章
给主人留下些什么吧!~~
评论热议
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通