views:

8

answers:

0

Hi, I am creating a class in PHP to work with Fotolia API. In some cases there is a need to authenticate the request. I have created a method which is listed below :


 private function prepareContext( $request ) {
  $context = array();
  $context['method'] = 'POST';
  $context['content'] = $request; 

  $context['header'] = 
    "Content-Type: text/xml; charset=utf-8\r\n".
    ( $this->getSession() !== null ? "Cookie: PHPSESSID=".$this->getSession()."; path=/; domain=.fotolia.com" : "" );
  return stream_context_create( array('http' => $context ) );
 }

I receive the ID of the session from Fotolia, and I include it into the header but I got only faultCode(21) : Invalid Session ID. How do I set the session ID properly in the header? What is important on my local XAMPP my class with method works quite well, but uploading it on a virtual live server it crashes.

Did anyone faced similiar problem ?