I access a REST api service that utilizes a variable called session_id. The API calls for this to be stored in a cookie and I accomplish this as follows:
$ch
Cookies are simple text headers sent along with the request. CURL allows you to specify those directly using CURLOPT_COOKIE
.
curl_setopt($ch, CURLOPT_COOKIE, 'key=value;anotherkey=anothervalue');
If you know what information to send, you can construct your own cookie header this way. The COOKIEJAR/COOKIEFILE options just automate parsing, saving and sending. You'll have to do that manually (read received Cookie headers, create Cookie headers to be send), if you don't want to write to a file.