title: Connect to a Symfony application through CURL
body: <p><br>
  I have an application built in Symfony. I have another application in PHP and trying to check if the current user has any account in the Symfony application and authenticate him to obtain the PHPSessionID? In this case I use <em>CURL</em> command as below. How ever the username and password is correct but still the symfony application redirect me to the login page. Does anybody know how can I fix this?</p>
  
  <pre><code>$cred_data = array('_username' =&gt; 'test1', '_password' =&gt; '123', '_target_path' =&gt; 'http://symfonyappdomain/Symfony/web/app_dev.php/Acme/HomePage');
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'http://symfonyappdomain/Symfony/web/app_dev.php/Acme/login_check');
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cred_data));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_COOKIESESSION, true);
  curl_setopt($ch, CURLOPT_HEADER, true);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
  $result = curl_exec($ch);
  </code></pre>
  
  <p>Appreciate it</p>