开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜