我正在尝试使用curl获取cookie,然后设置它。
我正在使用curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookie.txt')
将Cookie保存到文件中。
然后这些命令设置cookie:
$cookie = file_get_contents('/tmp/cookie.txt');
setcookie('CAKEPHP', $cookie, 0, '/', 'moxo-adhdtest.com', false, true);
这是cookie.txt的内容:
# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_.moxo-adhdtest.com TRUE / FALSE 1402594989 CAKEPHP tn1amoins09t7h94h05od1a4s4
它被保存到编码的浏览器中:
%23+Netscape+HTTP+Cookie+File%0A%23+http%3A%2F%2Fcurl.haxx.se%2Frfc%2Fcookie_spec.html%0A%23+This+file+was+generated+by+libcurl%21+Edit+at+your+own+risk.%0A%0A%23HttpOnly_.moxo-adhdtest.com%09TRUE%09%2F%09FALSE%091402594989%09CAKEPHP%09tn1amoins09t7h94h05od1a4s4%0
甲
我尝试使用 setrawcookie ,我得到FALSE,所以这没有帮助
如何正确设置并且不编码?