How to save Cookies from a remote site with cURL?

2

I'm having trouble saving and reading cookies from a remote site I'm opening with cURL:

            $cr = curl_init($this->_URL);
            curl_setopt($cr, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($cr, CURLOPT_USERAGENT, $useragent );           
            curl_setopt($cr, CURLOPT_COOKIEFILE, 'cookie.txt');   
            $html = curl_exec($cr); 
            curl_close($cr); 

I've tried COOKIEJAR and etc, but it does not work!

The site that I'm opening in cURL saves cookies when we click on a certain value, this cookie is later read by another site file, I tested with the Glype project proxy, and works perfectly, it saves the cookie, even if I open the site by my cURL and accessing the file that read the cookies by the glype proxy that is on the same server, it finds the cookies, but my cURL does not think!

How do I save and later read cookies from a remote site using cURL?

    
asked by anonymous 27.03.2015 / 08:25

1 answer

2

Replace cURL with HttpRequest link

It is object oriented and much better documented as well as easier to use.

    
27.03.2015 / 22:53