Jump to content

MSN via PHP?


TechZone

Recommended Posts

[quote]Only via COM or .NET using PHP from a Windows Server...[/quote]

Bollocks. Its just a protocol like any other. If your keen enough it can be done with sockets. However, there doesn't seem to be a great deal of documentation around for it (per usual MS style) and I haven't seen it implimented in php yet. There is a module for Python though called [url=http://auriga.wearlab.de/~alb/msnlib/]libmsn[/url] which comes complete with a simple msn client. You might be able to get some ideas from that.
Link to comment
https://forums.phpfreaks.com/topic/28045-msn-via-php/#findComment-128365
Share on other sites

[quote]It would primitive at best, because PHP sockets is not as robust as you seem to believe.[/quote]

In what way are they not as robust as I believe? Ive worked with webservers written using php's socket functionality and as far as I can tell they are plenty robust enough.

And.... well what do y'know? Someone [i]has[/i] implimented the MSN potocol in php. [url=http://flumpcakes.co.uk/php/msn-messenger]Linky[/url].
Link to comment
https://forums.phpfreaks.com/topic/28045-msn-via-php/#findComment-128818
Share on other sites

Interesting...I tried to use this class, and I ALWAYS get an auth failed error...the passcode is right (checked with MSN messenger)

EDIT: Looked into the code...seems like there is a problem with the private function _ssl_auth where it cannot return the right authentication string(s)...that is causing it to return false which generated the auth failed error...any ideas on fixing? The code is here:

[code]
function _ssl_auth($auth_string)
{
if (empty($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='.$passport.',pwd='.$password.','.$auth_string.'"';

exec($this->curl." -m 60 -LkI -H ".$header1."https://".$this->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)) ? $out : false;
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/28045-msn-via-php/#findComment-129457
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.