[eluser]quasiperfect[/eluser]
hi
i'm building a connector from a ci project to a forum.
i created a controller where i dump some user session values
from the forum i'm calling the controller using curl but i get no results (i get the default value like no user session is started)
if i call the controller after i'm logged in it works so my problem is to pass the session along with curl.
what i have now
Code:
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1/ci/forum_connector/');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
curl_setopt ($ch, CURLOPT_COOKIEFILE,'incookie');
$results = curl_exec($ch);
curl_close($ch);
}
thanks in advance for any help
[edit]
i solved my problem i replaced all curl_setop section with this
Code:
$cookie = (isset($_COOKIE['ci'])) ? 'ci='.urlencode($_COOKIE['ci']):'';
$httpua = (isset($_SERVER['HTTP_USER_AGENT']))? $_SERVER['HTTP_USER_AGENT'] : '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1/ci/forum_connector/');
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, $httpua);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
replace $_COOKIE['ci'] with $_COOKIE['yoursession cookie name']