I'm trying to log into Live.com with curl, but so far nothing has worked. It always says my password is wrong even when I use my correct credentials. Anyone have any suggestions?
Here is my current code for testing:
<?
$user = $_POST['username'];
$pass = $_POST['password'];
$user = strip_tags($user);
$pass = strip_tags($pass);
$user = trim($user);
$pass = trim($pass);
$useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
$loginURL = "https://login.live.com/ppsecure/post.srf";
$post = 'PPSX=PassportRN&PwdPad=&type=&login='.$user.'&passwd='.$pass.'&LoginOptions=2';
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1); //POST
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //Follow redirects
curl_setopt($ch, CURLOPT_USERAGENT, $useragent); //User Agent
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_URL, $loginURL);
$result = curl_exec($ch);
curl_close($ch);
echo"<<<START>>>";
print $result;
echo"<<<END>>>";
?>