用的是 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);
`
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.