title: login to modx from external/other server revolution 2.2.5
body: <p>I am pissed off with this problem from 2 days.</p>
  
  <p>I am using <strong>MODx Revolution 2.2.5 (traditional)</strong> and want to login to modx from external server just to fetch some user details.</p>
  
  <p>1) I know that runprocessor method works only if i am logged in to manager (unfortunately, that's the only way i know to login user in) So i tried IFRAME method to avoid (cross scripting) it worked perfectly but i am not able to read the data from IFRAME using javascript because of same issue, cross domain access policy.</p>
  
  <p>When i try to post data using some other method like CURL, Ajax using </p>
  
  <pre><code>header("Access-Control-Allow-Origin: *"); 
  </code></pre>
  
  <p>I am able to login (I see $response->response['success'] == 1) but cant access any data and it says</p>
  
  <pre><code>Fatal error: Call to a member function get() on a non-object
  </code></pre>
  
  <p>Below is the snippet code i am using</p>
  
  <pre><code>if(isset($_POST) &amp;&amp; count($_POST)){
      $c = array(
          'username' =&gt; $_POST['username'],
          'password' =&gt; $_POST['password']
      );
      $response = $modx-&gt;runProcessor('security/login',$c);
      if($response-&gt;response['success'] == 1){
          $user['id'] = $modx-&gt;user-&gt;get('id');
                  $profile = $modx-&gt;user-&gt;getOne('Profile');
          $user['fullname'] = $profile-&gt;get('fullname');
          $user['email'] = $profile-&gt;get('email');
          echo json_encode($user);
      }else{
          echo json_encode($response-&gt;response); 
      }
  }
  </code></pre>
  
  <p>2) I can use login snippet but it doesnt return output what i expect. We have ready site and we are already using login plugin so i cant even modify login plugin to respond with expected data</p>
  
  <p><strong>How can i login to modx using api or any other method ??</strong> </p>