title: Log user in to drupal remotely with service
body: <p>I am trying to get a user to login to drupal using an existing service. I am able to POST the username and password to drupal on the remote server and I do get authentication information back.</p>
  
  <p>My problem is how do I register the session so drupal knows I am logged in? Once I login, and try to access anything, I get <code>"Access denied for anonymous user"</code>.</p>
  
  <p>I noticed looking at the services notes that is says:</p>
  
  <p><code>Authentication : header Cookie must be set to &lt;session_name&gt;=&lt;sessid&gt; given by the login response of a successful login</code></p>
  
  <p>so I tried </p>
  
  <pre><code>$_SESSION[$curlResult-&gt;session_name] = $curlResult-&gt;sessid;
  </code></pre>
  
  <p>which I don't think is what that line above is saying. Not sure what a header cookie is.</p>
  
  <p><code>$curlResult-&gt;session_name</code> and  <code>$curlResult-&gt;sessid</code> are definitely valid and that is part of what is returned on successful login.</p>