PHP CURL Cookie Example

Setting Cookie Session id in PHP CURL

This example code will help to set cookie or session id in CURL. By default there is no cookie will be set.
$c = curl_init();
curl_setopt($c, CURLOPT_URL, 'http://www.example.com/');
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_COOKIE, "Cookie: cookieVariable=cokieValue; PHPSessionId=sntbiaj53dska4ryxgmc0su5");
$html = curl_exec($c);


Related Topic PHP Programming Best Practices
How to get the HTTP Cookie Value
How to set the HTTP Cookie Values
How to Clear the Cookie Values
How to Create the Dynamic Folder Tree Links Navigation
PHP  CURL  

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback