开发者

Can CURL request can be used set a cookie while requesting?

开发者 https://www.devze.com 2023-01-31 13:45 出处:网络
I\'m using curl to get the contents of a webpage.. The website sets cookies when i visit them using browser..

I'm using curl to get the contents of a webpage.. The website sets cookies when i visit them using browser..

Can i use the cU开发者_高级运维RL same way and send a request to that specific website with the cookie information...????


Here are some of the option I found useful regarding curl and cookies.

 curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt' ); //use this cookie file
 curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookie.jar'); //if you close the session the cookies will be saved here
 curl_setopt($ch, CURLOPT_COOKIE,"cookie_test=yes; domain=.google.com; path=/"); //set the cookie for the current session
0

精彩评论

暂无评论...
验证码 换一张
取 消