作者:a98246813 | 来源:互联网 | 2014-03-27 16:53
apache或者php,怎么设置页面的cookies?curl一个网站,法国天气网。返回的信息是Merci d'accepter les cookiesPour accepter les&nb
apache或者php,怎么设置页面的COOKIEs?
curl一个网站,法国天气网。
返回的信息是
Merci d'accepter les COOKIEs
Pour accepter les COOKIEs :
Sur Internet Explorer : Outils > Options Internet > Confidentialité > Avancé
Sur Firefox: Outils > Options > Vie privée > COOKIE > Accepter les COOKIEs
Nous vous informons que vous pouvez vous opposer à l'enregistrement de ces COOKIEs en configurant votre ordinateur selon les modalités détaillées sur le site de la CNIL. (http://www.cnil.fr)
大致意思是:
谢谢您接受COOKIEs
要接受COOKIE:
IE浏览器:工具> Internet选项>隐私>高级
在Firefox:工具>选项>隐私>饼干>接受COOKIEs
我们告诉你,你可能会反对COOKIE的配置您的计算机的CNIL的网站上详细登记。(http://www.cnil.fr)
CURLOPT_HEADER,true 之后,返回下述信息。
HTTP/1.1 302 Found Date: Thu, 24 Jan 2013 16:09:14 GMT Server: Apache Set-COOKIE: jknch=hcnkj; path=/; domain=meteofrance.com Location: http://token.meteofrance.com/?u=%68%74%74%70%3A%2F%2F%66%72%61%6E%63%65%2E%6D%65%74%65%6F%66%72%61%6E%63%65%2E%63%6F%6D%2F%66%72%61%6E%63%65%2F%61%63%74%75%2F%61%63%74%75%3F%70%6F%72%74%6C%65%74%5F%69%64%3D%39%30%31%33%36%26%64%6F%63%75%6D%65%6E%74%5F%69%64%3D%32%37%33%35%34&s=%73%69%6D%2D%70%6F%72%74%61%69%6C&x=%DC%45%F1%A6%56%AD%A9%DE Content-Length: 0 Content-Type: text/html HTTP/1.1 302 Found Date: Thu, 24 Jan 2013 16:09:19 GMT Server: Apache Location: http://france.meteofrance.com/NoCOOKIE.htm Content-Length: 0 Connection: close Content-Type: text/html HTTP/1.1 200 OK Date: Thu, 24 Jan 2013 16:09:20 GMT Server: Apache ETag: "8613ee-89f-4d0d0d2028c80" Accept-Ranges: bytes Xcache: Version 1.2 for Apache 2.2 Last-Modified: Thu, 24 Jan 2013 15:39:23 GMT Content-Length: 2207 Content-Type: text/html
我想请教,这个功能是在apache还是php里设置的?一定要求客户端接受COOKIEs才可以继续浏览?
------解决方案--------------------本帖最后由 xuzuning 于 2013-01-25 09:51:15 编辑
解释一下返回的头
HTTP/1.1 302
Found Date: Thu, 24 Jan 2013 16:09:14 GMT
Server: Apache
Set-COOKIE: jknch=hcnkj; path=/; domain=meteofrance.com
Location: http://token.meteofrance.com/?u=%68%74%74%70%3A%2F%2F%66%72%61%6E%63%65%2E%6D%65%74%65%6F%66%72%61%6E%63%65%2E%63%6F%6D%2F%66%72%61%6E%63%65%2F%61%63%74%75%2F%61%63%74%75%3F%70%6F%72%74%6C%65%74%5F%69%64%3D%39%30%31%33%36%26%64%6F%63%75%6D%65%6E%74%5F%69%64%3D%32%37%33%35%34&s=%73%69%6D%2D%70%6F%72%74%61%69%6C&x=%DC%45%F1%A6%56%AD%A9%DE
Content-Length: 0
Content-Type: text/html
HTTP/1.1 302
Found Date: Thu, 24 Jan 2013 16:09:19 GMT
Server: Apache
Location: http://france.meteofrance.com/NoCOOKIE.htm
Content-Length: 0
Connection: close
Content-Type: text/html
HTTP/1.1 200 OK