PHP get MSN Friends List _php Tutorial

Source: Internet
Author: User



<title>MSN Test</title>







# filename:fm.php
# purpose:get MSN Contact List
# Author:http://qartis.com/?qmsn Modified by Druggo

$username = $_post[username];
$password = $_post[password];
$debug = 0;
$trid = 0;
$proto = "MSNP10";

# Start Here
echo "Communication protocol $proto
";
echo "Start login
";
# login Now
$sbconn = Fsockopen ("messenger.hotmail.com", 1863) or Die ("Cant Connect to MSN server");
Flush ();
Data_out ("VER $trid $proto CVR0");
Data_in ();
Data_out ("CVR $trid 0x0409 winnt 5.1 i386 msnmsgr 8.0.0812 msmsgs $username");
Data_in ();
Data_out ("USR $trid TWN I $username");

$temp = data_in ();

if (!stristr ($temp, ":")) {
if (substr ($temp, 0, 3) ==601) {
#echo "Error:the MSN servers is currently unavailable.";
echo "Unfortunately, the MSN server is hung up >.<
";
Die ();
} else {
echo "Connection failed!
";
Fclose ($sbconn);
Die ();
}
}

@fclose ($sbconn);
$temp _array = Explode ("", $temp);
$temp _array = Explode (":", $temp _array[3]);
Flush ();
$sbconn = Fsockopen ($temp _array[0], $temp _array[1]) or Die ("Error-_-#");
Data_out ("VER $trid $proto CVR0");
Data_in ();
Flush ();
Data_out ("CVR $trid 0x0409 winnt 5.1 i386 msnmsgr 8.0.0812 msmsgs $username");
Data_in ();
Data_out ("USR $trid TWN I $username");
$temp = data_in ();
$temp _array = Explode ("", $temp);
Flush ();
$TOKENSTRING = Trim (end ($temp _array));
#echo "Authenticating";
echo "In Authentication ...
";
Flush ();

$nexus _socket = Fsockopen ("ssl://nexus.passport.com", 443);
Fputs ($nexus _socket, "get/rdr/pprdr.asp http/1.0");

while ($temp! = "") {
$temp = fgets ($nexus _socket,1024);
if (substr ($temp, 0,12) = = "Passporturls") {
$urls = substr ($temp, 14);
}
}

$temp _array = Explode (",", $urls);
$temp = $temp _array[1];
$temp = substr ($temp, 8);

$temp _array = Explode ("/", $temp);
@fclose ($nexus _socket);

$ssl _conn = Fsockopen ("ssl://". $temp _array[0],443);
Fputs ($ssl _conn, "GET/{$temp _array[1]} http/1.1");
Fputs ($ssl _conn, "authorization:passport1.4 orgverb=get,orgurl=http%3a%2f%2fmessenger%2emsn%2ecom,sign-in=". UrlEncode ($username). ", pwd= $password, $TOKENSTRING");
Fputs ($ssl _conn, "user-agent:msmsgs");
Fputs ($ssl _conn, "Host: {$temp _array[0]}");
Fputs ($ssl _conn, "connection:keep-alive");
Fputs ($ssl _conn, "Cache-control:no-cache");
$temp = fgets ($ssl _conn,512);

if (RTrim ($temp) = = "http/1.1 302 Found") {
#echo "redirection";
echo "Start redirection
";
Flush ();
while ($temp! = "") {
$temp = fgets ($ssl _conn,256);
if (substr ($temp, 0,9) = = "Location:") {
$temp _array = Explode (":", $temp);
$temp _array = Explode ("/", Trim (end ($temp _array));
Break
}
}
@fclose ($ssl _conn);
$ssl _conn = Fsockopen ("ssl://". $temp _array[2],443);
Fputs ($ssl _conn, "GET/{$temp _array[3]} http/1.1");
Fputs ($ssl _conn, "authorization:passport1.4 orgverb=get,orgurl=http%3a%2f%2fmessenger%2emsn%2ecom,sign-in=". UrlEncode ($username). ", pwd= $password, $TOKENSTRING");
Fputs ($ssl _conn, "user-agent:msmsgs");
Fputs ($ssl _conn, "Host: {$temp _array[2]}");
Fputs ($ssl _conn, "connection:keep-alive");
Fputs ($ssl _conn, "Cache-control:no-cache");
} elseif (RTrim ($temp) = = "http/1.1 401 Unauthorized") {
#echo "Invalidcreds";
echo "Verification failed!
";
@fclose ($ssl _conn);
Die ();
} else {
if (RTrim ($temp)! = "http/1.1 ok") {
#echo "Unknown HTTP status code: $temp
";
echo "Unknown status code $temp
";
Flush ();
Die ();
} else {
#echo "Set_bar_len30?";
}
}

while ($temp! = "") {
$temp = fgets ($ssl _conn,1024);
if (substr ($temp, 0,19) = = "Authentication-info") {
$auth _info = $temp;
$temp = fgets ($ssl _conn,1024);
if (substr ($temp, 0,14)! = "Content-length") {
$auth _info.= fgets ($ssl _conn,1024);
&

http://www.bkjia.com/PHPjc/486477.html www.bkjia.com true http://www.bkjia.com/PHPjc/486477.html techarticle ! DOCTYPE HTML Public-//w3c//dtd XHTML 1.0 transitional//en HTTP://WWW.W3.ORG/TR/XHTML1/DTD/XHTML1-TRANSITIONAL.DTD HTML xmlns=http://www.w3.org/1999/xhtml xml:lang=zh lang=zh head ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.