Setting a cookie for cURL to use

Heyidfc

New Member
I am retrieving another page using cURL, and unless I have a certain cookie I cannot see the page content. The cookie name is \[code\]seepage\[/code\] and its value must be set to 1 for me to see the page content.I would like to load this page using cURL, and this is the script I have at the moment:\[code\]<?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, 'http://www.pixhost.org/images/531/1245992_untitled-2.jpg');curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_HEADER, false);curl_setopt($ch, CURLOPT_COOKIE, 'tmpfile.tmp');curl_setopt($ch, CURLOPT_COOKIEJAR, 'tmpfile.tmp');curl_setopt($ch, CURLOPT_COOKIEFILE, 'tmpfile.tmp');curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);$result = curl_exec($ch);print_r($result);?>\[/code\]However, $result is an empty variable for which I can confirm with \[code\]if(empty($result))\[/code\]. How would I set cURL to use a cookie called \[code\]seepage\[/code\] with the cookie value being \[code\]1\[/code\]?Thanks.
 
Back
Top