I need to fetch some data from external site. To do this I need to load a site that creates some cookie and gives a simple math calculation to generate new link. This part is easy:
$cr = curl_init($url);
curl_setopt($cr, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cr, CURLOPT_COOKIEJAR, 'cookie.txt');
$html = curl_exec($cr);
curl_close($cr);
After those calls I have cookies stored in cookie.txt:
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
domain FALSE / FALSE 0 PHPSESSID o89t753egbp9pq9084n38eg2m1
Now, the question is: how can I load this cookie to use it in my next call to some other site (in the same domain ofcourse)?