title: facebook auto loging using php
body: <p>i want to make a auto loggin app using this but there's no result.
  is curl the best choice. and how can i pass my id and password because this isn't working.</p>
  
  <pre><code>            $fields = array(
                  "email" =&gt; "email",
          "password" =&gt; "PASS",
      );
  
          function curl($url,$fields)
          {
              foreach($fields as $key=&gt;$value) 
                  { 
                      $fields_string .= $key.'='.$value.'&amp;';
                      }
              rtrim($fields_string, '&amp;');
              $ch = curl_init();
              curl_setopt($ch, CURLOPT_URL, $url);
              curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
              curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
              $ip=rand(0,255).'.'.rand(0,255).'.'.rand(0,255).'.'.rand(0,255);
              curl_setopt($ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: $ip", "HTTP_X_FORWARDED_FOR: $ip"));
              curl_setopt($ch, CURLOPT_USERAGENT, " Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2");
              curl_setopt($ch,CURLOPT_POST, count($fields));
              curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
              curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
  
              $page = curl_exec($ch);
              curl_close($ch);
              return $page;
          }
  
          $res=curl('https://fr-fr.facebook.com?',$fields);
  
          echo $res;''''
  
  
  </code></pre>