Continuación del archivo anterior
Código PHP:
/*====================================*\
Various private functions
\*====================================*/
function _ssl_auth($auth_string)
{
if (empty($this->ssh_login))
{
if ($this->curl_bin)
{
exec("$this->curl -m 60 -LkI $this->nexus", $header);
$header = implode($header, null);
}
else
{
$ch = curl_init($this->nexus);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($ch, CURLOPT_TIMEOUT, 2);
$header = curl_exec($ch);
curl_close($ch);
}
preg_match ('/DALogin=(.*?),/', $header, $out);
if (isset($out[1]))
{
$slogin = $out[1];
}
else
{
return false;
}
}
else
{
$slogin = $this->ssh_login;
}
if ($this->curl_bin)
{
$header1 = '"Authorization: Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in='.$this->passport.',pwd='.$this->password.','.$auth_string.'"';
exec("$this->curl -m 60 -LkI -H $header1 https://$slogin", $auth_string);
$header = null;
foreach ($auth_string as $key => $value)
{
if (strstr($value, 'Unauthorized'))
{
echo 'Unauthorised';
return false;
}
elseif (strstr($value, 'Authentication-Info'))
{
$header = $value;
}
}
}
else
{
$ch = curl_init('https://'.$slogin);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in='.$this->passport.',pwd='.$this->password.','.$auth_string,
'Host: login.passport.com'
));
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($ch, CURLOPT_TIMEOUT, 2);
$header = curl_exec($ch);
curl_close($ch);
}
preg_match ("/from-PP='(.*?)'/", $header, $out);
return (isset($out[1])) ? $out[1] : false;
}
function _get()
{
if ($data = @fgets($this->fp, 4096))
{
if ($this->debug) echo "<div class=\"r\"><<< $data</div>\n";
return $data;
}
else
{
return false;
}
}
function _put($data)
{
fwrite($this->fp, $data);
$this->trID++;
if ($this->debug) echo "<div class=\"g\">>>> $data</div>";
}
function _get_error($code)
{
switch ($code)
{
case 201:
return 'Error: 201 Invalid parameter';
break;
case 217:
return 'Error: 217 Principal not on-line';
break;
case 500:
return 'Error: 500 Internal server error';
break;
case 540:
return 'Error: 540 Challenge response failed';
break;
case 601:
return 'Error: 601 Server is unavailable';
break;
case 710:
return 'Error: 710 Bad CVR parameters sent';
break;
case 713:
return 'Error: 713 Calling too rapidly';
break;
case 731:
return 'Error: 731 Not expected';
break;
case 800:
return 'Error: 800 Changing too rapidly';
break;
case 910:
case 921:
return 'Error: 910/921 Server too busy';
break;
case 911:
return 'Error: 911 Authentication failed';
break;
case 923:
return 'Error: 923 Kids Passport without parental consent';
break;
case 928:
return 'Error: 928 Bad ticket';
break;
default:
return 'Error code '.$code.' not found';
break;
}
}
}
?>
Archivo
usage.php Código PHP:
<html>
<head>
<title>Sample msn contacts list grabber</title>
<style type="text/css">
.g {color: green}
.r {color: red}
.b {color: blue}
</style>
</head>
<body>
<?php
if((isset($_POST['username'])) && (isset($_POST['password']))) {
include('msn_contact_grab.class.php');
$msn2 = new msn;
$returned_emails = $msn2->qGrab($_POST['username'], $_POST['password']);
echo "<table border='1'>";
foreach($returned_emails as $row){
echo "<tr><td>".$row['0']."</td><td>".$row['1']."</td></tr>";
};
echo "</table>";
}
?>
<form action="usage.php" method="POST">
Username:<input type="text" name="username" /><br>
Password:<input type="password" name="password" /><br>
<input type="submit" />
</form>
</body>
</html>
Me marca este error
Could not connect to messenger service