是否有人做过 phpwind 的 post 发帖呢?遇到几个问题了。

2015-12-23 23:38:06 +08:00
 fkbd
用的是 curl 的 post 提交,可是当我提交给 phpwind 时候 会出现 “非法请求,请返回重试!”的问题。
贴出代码:
`
$url='http://bbs.xxx.com/post.php?';
$post_fields = '
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="atc_usesign"
``
1
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="replytouser"
`
`
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="atc_convert"
``
1
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="atc_autourl"
``
1
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="step"
``
2
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="type"
``
ajax_addfloor
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="action"
``
reply
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="fid"
``
152
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="pid"
`
`
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="cyid"
`
`
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="tid"
`
12531290
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="stylepath"
`
houdaov3
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="ajax"
`
1
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="verify"
`
8bf9a1f3
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="_hexie"
`
1bd43ba8
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="iscontinue"
`
0
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="atc_title"
`
123
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="atc_content"
`
666
------WebKitFormBoundaryLxTpwutjFfCXkj40
Content-Disposition: form-data; name="usernames"
`
`
------WebKitFormBoundaryLxTpwutjFfCXkj40--
`
';
`
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
$contents = curl_exec($ch);
curl_close($ch);
`
2270 次点击
所在节点    问与答
5 条回复
yylzcom
2015-12-24 05:39:02 +08:00
去模拟发一次帖子然后抓包,我记得 Discuz 和 PHP wind 都是有验证值在页面里, post 的时候是要带上验证值的。 post 之前先抓一次页面拿到这个值,然后作为一个参数提交。
pynix
2015-12-24 06:16:16 +08:00
PHP 用 curl 好麻烦的样子。。。
pynix
2015-12-24 06:16:56 +08:00
chrome devtool 里面看下 network 应该可以找到问题。
pynix
2015-12-24 06:17:23 +08:00
里面有 copy as curl
ly710
2015-12-24 09:47:42 +08:00
只做过 discuz ,要先去访问一个页面把页面表单里隐藏的值抓下来再去 post 的。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/245729

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX