title: Login to AOL mail with curl PHP
body: <p>I make a reseach for a long time but the result is not good, it's always return me to the login page. I've set the post params, header, proxy ....</p>
  
  <p>I use the Live HTTP Headers plugin of FireFox to se what is the POST content contains and then set it to my code, but it still not work. Here is my code:</p>
  
  <pre><code>function show($content)
  {
      echo "&lt;textarea&gt;$content&lt;/textarea&gt;";
  }
  function aol($mail,$pass, $_sock){
      $url="http://mail.aol.com";     
      $ch = curl_init();      
      curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
      curl_setopt($ch, CURLOPT_PROXY, $_sock);
      curl_setopt($ch, CURLOPT_HEADER, 1);
      curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1");
      curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  
      $content=curl_exec ($ch);
      $this-&gt;show($content);
      //Get SNS_SC
      $SNS_SC=explode('SNS_SC=', $content);
      $SNS_SC=explode(';', $SNS_SC[1]);
      $SNS_SC=$SNS_SC[0];     
      //  //Get Site State
      $siteState=explode('siteState" value="', $content);
      $siteState=explode('"', $siteState[1]);
      $siteState=$siteState[0];
  
      //Get usrd
      $usrd=explode('usrd" value="', $content);
      $usrd=explode('"', $usrd[1]);
      $usrd=$usrd[0];
  
      $url="https://my.screenname.aol.com/_cqr/login/login.psp";
      $post="sitedomain=sns.webmail.aol.com&amp;siteId=&amp;lang=en&amp;locale=us&amp;authLev=0&amp;siteState=$siteState&amp;isSiteStateEncoded=true&amp;mcState=initialized&amp;uitype=std&amp;use_aam=0&amp;offerId=newmail-en-us-v2&amp;seamless=novl&amp;regPromoCode=&amp;usrd=$usrd&amp;doSSL=&amp;redirType=&amp;xchk=false&amp;tab=&amp;lsoDP=&amp;loginId=$mail&amp;password=$pass";
      //ref
      $ref="https://my.screenname.aol.com/_cqr/login/login.psp?sitedomain=sns.webmail.aol.com&amp;lang=en&amp;seamless=novl&amp;offerId=newmail-en-us-v2&amp;authLev=0&amp;siteState=$siteState&amp;locale=us";
  
  
      //
  
      $arr[] = "Host: my.screenname.aol.com";
      $arr[] = "User-Agent: Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1";
      $arr[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
      $arr[] = "Accept-Language: en-us,en;q=0.5";
      $arr[]="Accept-Encoding: gzip, deflate";
      $arr[]="Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
      $arr[] = "Keep-Alive: 300";
      $arr[] = "Connection: keep-alive";
      $arr[] = "Referer: ".$ref;
      $arr[] = "Cookie: SNS_SC=" . $SNS_SC ;
      $arr[] = "Content-Type: application/x-www-form-urlencoded";
      $arr[] = "Content-Length: " . strlen($post);
      //$arr[] = $post;
      //
      curl_setopt($ch, CURLOPT_HEADER, $arr);
      curl_setopt($ch, CURLOPT_POST ,1);
      curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);       
      curl_setopt($ch, CURLOPT_URL, $url);                
      curl_setopt($ch, CURLOPT_REFERER, $ref);        
  
      $result=curl_exec ($ch);
  
      curl_close ($ch);
      //$this-&gt;show($result);
      echo $result;       
      return 0;
  }
  </code></pre>
  
  <p>Any idea? Thanks :)</p>