+
95
-

回答

一、curl

curl -b 参数来携带COOKIE发送请求,例如:

$ curl -b 'foo1=bar;foo2=bar2' https://google.com

也可以先保存COOKIE,然后再发送COOKIE文件

$ curl -c COOKIEs.txt https://www.google.com

$ curl -b COOKIEs.txt https://www.google.com

-c参数将服务器设置的 COOKIE 写入一个文件。

二、wget

wget可以直接通过header发送COOKIE头

wget --header="COOKIE: XXXX"

当然wget也可以跟curl一样先保存COOKIE文件下次请求再读取.

$ wget –COOKIEs=on –keep-session-COOKIEs –save-COOKIEs=COOKIE.txt https://google.com

然后使用 COOKIE

$ wget –referer=”http://www.domainname.com/” –COOKIEs=on –keep-session-COOKIEs –load-COOKIEs=COOKIE.txt https://google.com

网友回复

我知道答案,我要回答