curl_setopt($curl_session, CURLOPT_URL, $url_post); curl_setopt($curl_session, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0.1) Gecko/20100101 Firefox/8.0.1"); curl_setopt($curl_session, CURLOPT_POST, 1); curl_setopt($curl_session, CURLOPT_REFERER, "http://hi.baidu.com/liuanqi3/blog/create"); curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl_session, CURLOPT_SSL_VERIFYHOST, 1); curl_setopt($curl_session, CURLOPT_POSTFIELDS, $content_post); //curl_setopt($curl_session, CURLOPT_COOKIEJAR, $cookie_jar); curl_setopt($curl_session, CURLOPT_COOKIEFILE, $cookie_jar); curl_setopt ($curl_session, CURLOPT_RETURNTRANSFER, 1);
生成的cookie 文件是这样
# Netscape HTTP Cookie File # http://curl.haxx.se/rfc/cookie_spec.html # This file was generated by libcurl! Edit at your own risk. .baidu.com TRUE / FALSE 1365155562 BAIDUID BDDFCD14EA0AD5C1B38EDFD0DDCCB34E:FG=1 .baidu.com TRUE / FALSE 0 BDUSS 85TmQyZ350VmdLN0gxdjVldjBvVUN-WDBUTVVXTFJLRUVlMEN1MWw0SnF1V3BRQUFBQUFBJCQAAAAAAAAAAApRIA57zggGbGl1YW5xaTMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgusRwAAAAAOC6xHAAAAAAuWZCAAAAAAAxMC4yMy4yNGprfU9qa31PVm #HttpOnly_.passport.baidu.com TRUE / FALSE 0 PTOKEN 1184d4bd2d80961354d3eae7f6de6ff2 .passport.baidu.com TRUE / FALSE 0 STOKEN a2dbfbc5bb86151850526e70f6f40a66 #HttpOnly_.baidu.com TRUE / FALSE 0 PTOKEN .baidu.com TRUE / FALSE 1893456000 USERID 70bd897a5d1f0eea3c423d9f .hi.baidu.com TRUE / FALSE 0 BDSP a4c27d1ed31a0ef411c28743a60a59dcb4e2c9dacd335a60e53ff925ab18972bd40735fae6cd7b899e510fb30f2442a7d933c895d143ad4bd11373f082025aafa40f4bfbfbedab64034f78f0f736afc379310a55b319ebc4b74543a98226cffc1c179f08 .hi.baidu.com TRUE / FALSE 1806659562 BDSTAT 62d0f703fbe4dda308fa513d5e2f8f7b2ddb836eb2fb431664224f4a23a41d47
我如果在 提交数据数据的时候
curl_setopt($curl_session,CURLOPT_HTTPHEADER,array(cookie:..... )
就没有问题,就可以发表成功
怎么没人回答我的问题呢...######
$cookie_jar的内容是什么?加上
curl_setopt($curl_session, CURLOPT_VERBOSE, 1);
看看有什么输出?
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。