[eluser]skunkbad[/eluser]
Just trying to pass all cookies through to another script, but even though $opts array looks good, apache_request_headers() in the receiving script doesn't show the cookies. Are they being destroyed by CI or something:
Code:
public function index()
{
$opts['http']['method'] = 'GET';
$opts['http']['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
if( count( $_COOKIE ) > 0 )
{
$cookie_string = 'Cookie: ';
$i = 1;
foreach( $_COOKIE as $k => $v )
{
if( $i !== 1 )
{
$cookie_string .= '; ';
}
$cookie_string .= $k . '=' . urlencode( $v );
$i++;
}
$opts['http']['header'][] = $cookie_string;
}
$context = stream_context_create( $opts );
echo file_get_contents( 'http://domain.com/my_script', FALSE, $context );
}
PHP has curl wrappers, so that's why header in array