Hi Everybody, i wanna ask about something in PHP/CURL. when i set my script to open a specific website using curl and this site sets a cookies i want to know where's the cookies saved ? server or client side. also is there any curl option that saves or copy this cookies in an array or soemthing similar that can allow me access the cookie that comes from the remote url?
In the majority of cases, the cookie is stored client-side (in a text file). It's possible for the server to store a cookie server-side, but it's more of a hack than anything. For example, instead of saving settings in a cookie stored on the user's machine - it's possible to store them on the server-side and associate those settings with the user's IP address. It's not really common, but it does happen. In those cases, there's not much you can do as far as viewing/editing the cookie goes. The easiest way is call curl_setopt(). For example: curl_setopt($ch, CURLOPT_COOKIEJAR, "digitalpoint-cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "digitalpoint-cookies.txt"); cURL will load the cookies from the file specified with CURLOPT_COOKIEJAR, and it will save the cookies (usually when the connection is closed) to the file specified in COOKIEFILE. To avoid confusion, it's best to just specify the same filename for both.