Foros del Web » Programando para Internet » PHP »

Obtener lista contactos Messenger PHP

Estas en el tema de Obtener lista contactos Messenger PHP en el foro de PHP en Foros del Web. Hola, me gustaria saber si alguien conoce o dispone de un script que he visto en algunas webs, donde, dandole tu direccion de hotmail y ...
  #1 (permalink)  
Antiguo 26/02/2006, 19:43
 
Fecha de Ingreso: noviembre-2005
Mensajes: 37
Antigüedad: 18 años, 5 meses
Puntos: 0
Obtener lista contactos Messenger PHP

Hola, me gustaria saber si alguien conoce o dispone de un script que he visto en algunas webs, donde, dandole tu direccion de hotmail y tu password, obtiene la lista de contactos y envia un mail a los usuarios que esten en ella, espero podais ayudarme, encontre una de un pakistani pero funciona 1 si y 300 no, a ver si me podeis ayudar

gracias!
  #2 (permalink)  
Antiguo 26/02/2006, 20:18
Avatar de uamistad  
Fecha de Ingreso: diciembre-2004
Ubicación: Cd. de México
Mensajes: 1.395
Antigüedad: 19 años, 4 meses
Puntos: 1
Ya van varios que preguntan eso, ¿en dónde viste esa aplicación? Puedes buscar en el foro, hay algunos POST como el tuyo, pero nadie da con ese algoritmo.

¿ Puedes publicar en dónde viste esa aplic. funcionando para ir a verla ?
__________________
"Di no al Internet Explorer" -Proverbio Chino-
  #3 (permalink)  
Antiguo 27/02/2006, 04:11
 
Fecha de Ingreso: marzo-2005
Mensajes: 30
Antigüedad: 19 años, 1 mes
Puntos: 0
Yo encontre algo asi en WebTaller.com

Cita:
Iniciado por webtaller
Nombre: Phassport v0.6 (descarga)
Descripción: Clase que permite conectarte al servidor del Messenger a través de una cuenta de correo que se le especifique, recuperando de tu lista de contactos los usuarios que están online en ese momento. Los resultados se muestran en una página, usando todos los smilies disponibles en MSN para mostrar los nicks (ver screenshot). Ésta clase es experimental, lee bien el archivo README adjuntado antes de proceder. (Espero que los usuarios de windows veais bien los retornos de carro en los archivos del zip)
Autor: phptorpes
Idioma: Español
Clicks: 2315 veces visitado.
Se encuentra en "Construcción > Lenguajes > PHP > Códigos ya Escritos > Sistemas de Usuarios"

No lo he probado.
  #4 (permalink)  
Antiguo 27/02/2006, 05:04
 
Fecha de Ingreso: noviembre-2005
Mensajes: 37
Antigüedad: 18 años, 5 meses
Puntos: 0
Pues no me funciona la web de webtaller... pero el script lo tengo,esta hecho con Curl, pero la verdad, falla muchisimo, y la mitad de las veces no hace nada, asi que me gustaria algo mas fiable, hay herramientas de pago (poner en el google import hotmail php) o cosas asi y salen...pero gratis no hay nada?

Salu2!
  #5 (permalink)  
Antiguo 28/02/2006, 02:08
Avatar de xyyy7  
Fecha de Ingreso: enero-2004
Ubicación: Maracay.-
Mensajes: 637
Antigüedad: 20 años, 2 meses
Puntos: 5
Cita:
Iniciado por uamistad
Ya van varios que preguntan eso, ¿en dónde viste esa aplicación? Puedes buscar en el foro, hay algunos POST como el tuyo, pero nadie da con ese algoritmo.

¿ Puedes publicar en dónde viste esa aplic. funcionando para ir a verla ?
Aqui hay un componente de tress scripts :

VerMsn.php
Cita:
<?php
ob_implicit_flush();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Msn</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript"></script>
<style type="text/css" media="screen" title="default">
body {
font: 76%/1.4 tahoma, verdana, arial, helvetica, sans-serif;
}
.r {
color: red;
}
.g {
color: green;
}
</style>
</head>
<body>

Código PHP:
<?php


    
include('msnp9.class.php');
    include(
'msn_sb.class.php');

    
$msn = new msn;

    if (
$msn->connect('[email protected]''tu-password'))
    {
        
// we're connected
        // run rx_data function to 'idle' on the network
        // rx_state will loop until the connection is dropped

        
$msn->rx_data();

        echo 
'<p>Connection dropped</p>';
    }
    else
    {
        
// wrong username and password?
        
echo '<p>Error Connecting to the MSN Network</p>';
    }


?>



  </body>
</html>
msn_sb.class.php
Código PHP:
<?php

class switchboard
{
    
// font colours/styles
    
var $font_fn 'Arial';
    var 
$font_co '333333';
    var 
$font_ef '';


    
// other
    
var $debug 1;
    var 
$trID 1;
    var 
$email '';


    function 
switchboard()
    {
        
$this->session_start_time time();
    }


    
/**
     *
     * desc    :    send IM message
     *
     * in    :    $ns        =    notification server connection
     *        $msg        =    message to send
     *        $passport    =    current logged in user
     *        $email        =    user to send message to
     *
     * out    :    true on success else return false
     *
     */

    
function tx_im($ns$msg$passport$email)
    {
        
$message "MIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8\r\nX-MMS-IM-Format: FN=$this->font_fn; EF=$this->font_ef; CO=$this->font_co; CS=0; PF=22\r\n\r\n$msg";
        
$message "MSG 20 N ".strlen($message)."\r\n$message";

        if (@
is_resource($this->sb))
        {
            
// switchboard session already open
            
$this->_put($message);

            return 
true;
        }
        else
        {
            
// open switchboard session through NS
            
fputs($ns"XFR $this->trID SB\r\n");


            
$ns_data fgets($ns4096);

            @list(
$xfr,,, $server,, $as) = explode(' '$ns_data);

            if (
$xfr != 'XFR')
            {
                echo 
'unable to read NS info. last message: ';
                echo 
$ns_data;

                return 
false;
            }



            list(
$server$port) = explode(':'$server);

            if (
$this->sb = @fsockopen($server$port$errno$errstr5))
            {
                
$this->_put("USR $this->trID $passport $as\r\n");
                
$this->_get();

                if (
is_array($email))
                {
                    foreach(
$email as $key => $value)
                    {
                        
$this->_put("CAL $this->trID $value\r\n");

                        if (
strstr($this->_get(), 'CAL'))
                        {
                            
$this->_get(); // should be JOI...
                        
}
                    }
                }
                else
                {
                    
$this->_put("CAL $this->trID $email\r\n");

                    if (
strstr($this->_get(), 'CAL'))
                    {
                        
$this->_get(); // should be JOI...
                    
}
                }



                
$this->_put($message);

                return 
true;
            }
        }

        return 
false;
    }


    
/**
     *
     * desc    :    recieve an IM from the switchboard
     *
     * in    :    none
     * out    :    a. null on fail/no message
     *        b. message string
     *
     */

    
function rx_im()
    {
        
$message null;
        
$msglen null;

        
stream_set_timeout($this->sb1);

        while (!
feof($this->sb))
        {
            
$data = ($msglen) ? $this->_get($msglen) : $this->_get();


            switch (
substr($data03))
            {
                default:
                    
//if (empty($msglen)) continue;

                    
$message.= $data;

                    if (
strlen($message) >= $msglen && !empty($msglen))
                    {
                        
$mesg explode("\n"trim($message));

                        
$last end($mesg);


                        
//if (@substr($last, 0, 10) != 'TypingUser')
                        
if (!strstr($message'TypingUser'))
                        {
                            
// this isn't a notification that the user is typing a message
                            
return $last;
                        }


                        
$msglen null;
                        
$message null;
                    }

                    if (
$this->session_start_time 10 time())
                    {
                        
// looks like we've been idle for a while
                        
echo 'IM timed out';
                        
$this->im_close();
                        return 
null;
                    }
                break;
                case 
'MSG':
                    list(,,, 
$msglen) = explode (' '$data);
                break;
                case 
'BYE':
                    return 
null;
                break;
            }
        }

        return 
null;
    }


    
/**
     *
     * desc    :    authorise with switchboard from an IM invitation
     *
     * in    :    $server        =    switchboard server ip
     *        $port        =    switchboard server port
     *        $passport    =    logged in users passport email
     *        $sID        =    session id
     *        $as        =    auth string
     *
     * out    :    true on success else return false
     *
     */

    
function auth($server$port$passport$sID$as)
    {
        if (
$this->sb = @fsockopen($server$port$errno$errstr5))
        {
            
$this->_put("ANS $this->trID $passport $as $sID\r\n");

            if (!
$this->rx_iro()) return false;

            return 
true;
        }

        return 
false;
    }


    
/**
     *
     * desc    :    recieve IRO commands from IM session
     *
     * in    :    none
     * out    :    true on success else return false
     *
     */

    
function rx_iro()
    {
        if (
$data $this->_get())
        {
            @list(
$iro, , $cur_num$tot$email$name) = explode(' '$data);

            
$sbsess->email $email;

            if (
$iro != 'IRO')
            {
                echo 
"** BAD data in rx_iro(): see line above **\n";
                return 
false;
            }

            
// recieve names/list of others connected
            
for ($i=1$i<$tot$i++)
            {
                if (!
$data $this->_get())
                {
                    echo 
"** BAD data in rx_iro(): see line above **\n";
                    return 
false;
                }

            }

            @list(
$ans) = explode(' '$this->_get());

            if (
$ans != 'ANS') return false;

            return 
true;
        }

        return 
false;
    }


    
/**
     *
     * desc    :    close switchboard connection
     *
     * in    :    none
     * out    :    none
     *
     */

    
function im_close()
    {
        
$this->_put("OUT\r\n");
        @
fclose($this->sb);
    }


    
/*====================================*\
        Various private functions
    \*====================================*/

    
function _get($use_fread=0)
    {
        
$data = ($use_fread) ? @fread($this->sb$use_fread) : @fgets($this->sb4096);

        if (
$data)
        {
            if (
$this->debug) echo "<div class=\"r\">&lt;&lt;&lt; SB: $data</div>\n";
            return 
$data;
        }
        else
        {
            return 
false;
        }
    }

    function 
_put($data)
    {
        @
fputs($this->sb$data);
        
$this->trID++;

        if (
$this->debug) echo "<div class=\"g\">&gt;&gt;&gt; SB: $data</div>";
    }
}

?>
....continua en el siguiete post
__________________
Maracay Edo Aragua - Venezuela :
Mi Favorita :
http://www.MySQL.Com
  #6 (permalink)  
Antiguo 28/02/2006, 02:08
Avatar de xyyy7  
Fecha de Ingreso: enero-2004
Ubicación: Maracay.-
Mensajes: 637
Antigüedad: 20 años, 2 meses
Puntos: 5
....continuacion

msnp9.class.php
Código PHP:
<?php

class msn
{
    
// messenger.hotmail.com is an exchange server
    // using it will redirect to a server with an open slot
    // using a known server ip will help connect faster

    // commenting out $ssh_login will mean the url to the
    // secure login server will be taken from a secure
    // session.  this will slow down connecting a bit.

    //var $server    =    'messenger.hotmail.com';
    
var $server    =    '65.54.239.20';
    var 
$port    =    1863;

    var 
$nexus    =    'https://nexus.passport.com/rdr/pprdr.asp';
    var 
$ssh_login    =    'loginnet.passport.com/login2.srf';

    var 
$debug    =    1;


    
// curl is used for the secure login, if you don't have
    // the php_curl library installed, you can use a curl binary
    // instead. $use_curl needs to be set to 1 to enable this.
    // set $curl to the path where curl is installed.
    // curl can be downloaded here: http://curl.haxx.se/download.html

    
var $curl_bin    =    0;
    var 
$curl    =    '/usr/local/bin/curl';    // linux
    //var $curl    =    'c:\curl.exe';        // windows




    /**
     *
     * desc    :    Connect to MSN Messenger Network
     *
     * in    :    $passport    =    passport i.e: [email protected]
     *        $password    =    password for passport
     *
     * out    :    true on success else return false
     *
     */

    
function connect($passport$password)
    {
        
$this->trID 1;

        if (
$this->fp = @fsockopen($this->server$this->port$errno$errstr2))
        {
            
$this->_put("VER $this->trID MSNP9 CVR0\r\n");

            while (! 
feof($this->fp))
            {
                
$data $this->_get();

                switch (
$code substr($data03))
                {
                    default:
                        echo 
$this->_get_error($code);

                        return 
false;
                    break;
                    case 
'VER':
                        
$this->_put("CVR $this->trID 0x0409 win 4.10 i386 MSNMSGR 6.2 MSMSGS $passport\r\n");
                    break;
                    case 
'CVR':
                        
$this->_put("USR $this->trID TWN I $passport\r\n");
                    break;
                    case 
'XFR':
                        list(, , , 
$ip)  = explode (' '$data);
                        list(
$ip$port) = explode (':'$ip);

                        if (
$this->fp = @fsockopen($ip$port$errno$errstr2))
                        {
                            
$this->trID 1;

                            
$this->_put("VER $this->trID MSNP9 CVR0\r\n");
                        }
                        else
                        {
                            if (! empty(
$this->debug)) echo 'Unable to connect to msn server (transfer)';

                            return 
false;
                        }
                    break;
                    case 
'USR':
                        if (isset(
$this->authed))
                        {
                            return 
true;
                        }
                        else
                        {
                            
$this->passport $passport;
                            
$this->password urlencode($password);

                            list(,,,, 
$code) = explode(' 'trim($data));

                            if (
$auth $this->_ssl_auth($code))
                            {
                                
$this->_put("USR $this->trID TWN S $auth\r\n");

                                
$this->authed 1;
                            }
                            else
                            {
                                if (! empty(
$this->debug)) echo 'auth failed';

                                return 
false;
                            }
                        }
                    break;
                }
            }
        }
        else
        {
            if (! empty(
$this->debug)) echo 'Unable to connect to msn server';

            return 
false;
        }
    }


    function 
rx_data()
    {
        
$this->_put("SYN $this->trID 0\r\n");
        
$this->_put("CHG $this->trID NLN\r\n");

        while (! 
feof($this->fp))
        {
            
$data $this->_get();

            if (
$data)
            {
                
//echo $data.'<br />';

                
switch($code substr($data03))
                {
                    default:
                        
// uncommenting this line here would probably give a load of "error code not found" messages.
                        //echo $this->_get_error($code);
                    
break;
                    case 
'CHL':
                        
$bits explode (' 'trim($data));

                        
$return md5($bits[2].'Q1P7W2E4J9R8U3S5');
                        
$this->_put("QRY $this->trID [email protected] 32\r\n$return");
                    break;
                    case 
'RNG':
                        
// someone's trying to talk to us
                        
list(, $sid$server, , $as$email$name) = explode(' '$data);
                        list(
$sb_ip$sb_port) = explode(':'$server);


                        
$sbsess = new switchboard;

                        if (
$sbsess->auth($sb_ip$sb_port$this->passport$sid$as))
                        {
                            
// sb session opened
                            // recieve users message
                            
if ($msg $sbsess->rx_im())
                            {
                                
// send the message straight back!
                                
$sbsess->tx_im($this->fp$msg$this->passport$email);

                                
// close IM sessions
                                
$sbsess->im_close();
                            }
                            else
                            {
                                echo 
'No message was received from user.';
                            }
                        }
                        else
                        {
                            echo 
'Unable to authenticate with switchboard.';
                        }
                    break;
                }
            }
        }
    }


    
/*====================================*\
        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($headernull);
            }
            else
            {
                
$ch curl_init($this->nexus);

                
curl_setopt($chCURLOPT_HEADER1);
                
curl_setopt($chCURLOPT_NOBODY1);
                
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
                
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
                
curl_setopt($chCURLOPT_RETURNTRANSFER1);
                
// 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($slogin);
            
curl_setopt($chCURLOPT_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($chCURLOPT_HEADER1);
            
curl_setopt($chCURLOPT_NOBODY1);
            
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
            
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
            
curl_setopt($chCURLOPT_RETURNTRANSFER1);
            
// 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->fp4096))
        {
            if (
$this->debug) echo "<div class=\"r\">&lt;&lt;&lt; $data</div>\n";

            return 
$data;
        }
        else
        {
            return 
false;
        }
    }


    function 
_put($data)
    {
        
fwrite($this->fp$data);

        
$this->trID++;

        if (
$this->debug) echo "<div class=\"g\">&gt;&gt;&gt; $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;
        }
    }

}


?>
.... es solo saber interpretar el algoritmo para sacar lo que queramos de ahi...

Saludos.-
__________________
Maracay Edo Aragua - Venezuela :
Mi Favorita :
http://www.MySQL.Com
  #7 (permalink)  
Antiguo 11/10/2006, 06:36
Avatar de lexus  
Fecha de Ingreso: enero-2002
Ubicación: Cali - Colombia
Mensajes: 2.234
Antigüedad: 22 años, 3 meses
Puntos: 4
aqui estan todos en sus paginas funcionapero cuando lo instalo en las mias no me fiunciona

http://jmstreet.info/
__________________
Control de Visitantes, Control de Accesos, Minutas digitales, Manejo de Correspondencia
http://www.controldevisitantes.com
  #8 (permalink)  
Antiguo 22/10/2006, 22:24
Avatar de lexus  
Fecha de Ingreso: enero-2002
Ubicación: Cali - Colombia
Mensajes: 2.234
Antigüedad: 22 años, 3 meses
Puntos: 4
oye sabes como funciona? siempre en todos los que tengo me sale un error de este tipo:
Fatal error: Call to undefined function: curl_init() in D:\sitios web\ComercioU\web\php\msnp9.class.php on line 257
donde lo que esta en esa linea es esto:
$ch = curl_init('https://'.$slogin);

en todos los scripts que he bajado me sale ese mismo error en esa misma linea como lo puedo solucionar?
__________________
Control de Visitantes, Control de Accesos, Minutas digitales, Manejo de Correspondencia
http://www.controldevisitantes.com
  #9 (permalink)  
Antiguo 22/10/2006, 22:36
Avatar de turco_7  
Fecha de Ingreso: diciembre-2003
Ubicación: Córdoba, Argentina
Mensajes: 1.044
Antigüedad: 20 años, 4 meses
Puntos: 19
tenes que instalar curl

saludos !
__________________
Mi Blog http://turco7.blogspot.com
Usuario Linux : 404289
Mi última página: http://www.digitalservicecba.com.ar - Reparacion de camaras digitales!
  #10 (permalink)  
Antiguo 01/11/2006, 19:17
Avatar de B**
B**
 
Fecha de Ingreso: enero-2006
Ubicación: Monterrey,Mexico
Mensajes: 952
Antigüedad: 18 años, 2 meses
Puntos: 3
Pues en phpclasess esta la clase del pakistani..Aqui
Pero a decir verdad.. no le entendi al "ejemplo"... no veo por donde se le pasen parametros.
__________________
-URL= Go PHP5.
-Age=22.
-Learning=PHP,J2EE,Struts,MAMBO,C++,JSON,AJAX,XHTML ,CSS.
  #11 (permalink)  
Antiguo 03/08/2007, 22:29
Avatar de kokecola2k2  
Fecha de Ingreso: febrero-2004
Mensajes: 130
Antigüedad: 20 años, 1 mes
Puntos: 0
Re: Obtener lista contactos Messenger PHP

el de la pagina http://jmstreet.info/ funciona pero segun leo, hay uno que puede no funcionar si el servidor donde lo pones tiene los puertos cerrados o algo asi, pero abajo esta el "werbservice" q supongo que lo q hace es contactar con su web y de hay darte los datos... porque en mi web el primer scrip no hacia na, se quedaba en blanco, el segundo si que va...
__________________
Gracias a los que me ayudaron, y a los que me ayudarán
  #12 (permalink)  
Antiguo 07/09/2007, 17:03
 
Fecha de Ingreso: mayo-2007
Mensajes: 1
Antigüedad: 16 años, 11 meses
Puntos: 0
Re: ....continuacion

Cita:
Iniciado por xyyy7 Ver Mensaje
msnp9.class.php
Código PHP:
<?php

class msn
{
    
// messenger.hotmail.com is an exchange server
    // using it will redirect to a server with an open slot
    // using a known server ip will help connect faster

    // commenting out $ssh_login will mean the url to the
    // secure login server will be taken from a secure
    // session.  this will slow down connecting a bit.

    //var $server    =    'messenger.hotmail.com';
    
var $server    =    '65.54.239.20';
    var 
$port    =    1863;

    var 
$nexus    =    'https://nexus.passport.com/rdr/pprdr.asp';
    var 
$ssh_login    =    'loginnet.passport.com/login2.srf';

    var 
$debug    =    1;


    
// curl is used for the secure login, if you don't have
    // the php_curl library installed, you can use a curl binary
    // instead. $use_curl needs to be set to 1 to enable this.
    // set $curl to the path where curl is installed.
    // curl can be downloaded here: http://curl.haxx.se/download.html

    
var $curl_bin    =    0;
    var 
$curl    =    '/usr/local/bin/curl';    // linux
    //var $curl    =    'c:\curl.exe';        // windows




    /**
     *
     * desc    :    Connect to MSN Messenger Network
     *
     * in    :    $passport    =    passport i.e: [email protected]
     *        $password    =    password for passport
     *
     * out    :    true on success else return false
     *
     */

    
function connect($passport$password)
    {
        
$this->trID 1;

        if (
$this->fp = @fsockopen($this->server$this->port$errno$errstr2))
        {
            
$this->_put("VER $this->trID MSNP9 CVR0\r\n");

            while (! 
feof($this->fp))
            {
                
$data $this->_get();

                switch (
$code substr($data03))
                {
                    default:
                        echo 
$this->_get_error($code);

                        return 
false;
                    break;
                    case 
'VER':
                        
$this->_put("CVR $this->trID 0x0409 win 4.10 i386 MSNMSGR 6.2 MSMSGS $passport\r\n");
                    break;
                    case 
'CVR':
                        
$this->_put("USR $this->trID TWN I $passport\r\n");
                    break;
                    case 
'XFR':
                        list(, , , 
$ip)  = explode (' '$data);
                        list(
$ip$port) = explode (':'$ip);

                        if (
$this->fp = @fsockopen($ip$port$errno$errstr2))
                        {
                            
$this->trID 1;

                            
$this->_put("VER $this->trID MSNP9 CVR0\r\n");
                        }
                        else
                        {
                            if (! empty(
$this->debug)) echo 'Unable to connect to msn server (transfer)';

                            return 
false;
                        }
                    break;
                    case 
'USR':
                        if (isset(
$this->authed))
                        {
                            return 
true;
                        }
                        else
                        {
                            
$this->passport $passport;
                            
$this->password urlencode($password);

                            list(,,,, 
$code) = explode(' 'trim($data));

                            if (
$auth $this->_ssl_auth($code))
                            {
                                
$this->_put("USR $this->trID TWN S $auth\r\n");

                                
$this->authed 1;
                            }
                            else
                            {
                                if (! empty(
$this->debug)) echo 'auth failed';

                                return 
false;
                            }
                        }
                    break;
                }
            }
        }
        else
        {
            if (! empty(
$this->debug)) echo 'Unable to connect to msn server';

            return 
false;
        }
    }


    function 
rx_data()
    {
        
$this->_put("SYN $this->trID 0\r\n");
        
$this->_put("CHG $this->trID NLN\r\n");

        while (! 
feof($this->fp))
        {
            
$data $this->_get();

            if (
$data)
            {
                
//echo $data.'<br />';

                
switch($code substr($data03))
                {
                    default:
                        
// uncommenting this line here would probably give a load of "error code not found" messages.
                        //echo $this->_get_error($code);
                    
break;
                    case 
'CHL':
                        
$bits explode (' 'trim($data));

                        
$return md5($bits[2].'Q1P7W2E4J9R8U3S5');
                        
$this->_put("QRY $this->trID [email protected] 32\r\n$return");
                    break;
                    case 
'RNG':
                        
// someone's trying to talk to us
                        
list(, $sid$server, , $as$email$name) = explode(' '$data);
                        list(
$sb_ip$sb_port) = explode(':'$server);


                        
$sbsess = new switchboard;

                        if (
$sbsess->auth($sb_ip$sb_port$this->passport$sid$as))
                        {
                            
// sb session opened
                            // recieve users message
                            
if ($msg $sbsess->rx_im())
                            {
                                
// send the message straight back!
                                
$sbsess->tx_im($this->fp$msg$this->passport$email);

                                
// close IM sessions
                                
$sbsess->im_close();
                            }
                            else
                            {
                                echo 
'No message was received from user.';
                            }
                        }
                        else
                        {
                            echo 
'Unable to authenticate with switchboard.';
                        }
                    break;
                }
            }
        }
    }


    
/*====================================*\
        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($headernull);
            }
            else
            {
                
$ch curl_init($this->nexus);

                
curl_setopt($chCURLOPT_HEADER1);
                
curl_setopt($chCURLOPT_NOBODY1);
                
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
                
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
                
curl_setopt($chCURLOPT_RETURNTRANSFER1);
                
// 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($slogin);
            
curl_setopt($chCURLOPT_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($chCURLOPT_HEADER1);
            
curl_setopt($chCURLOPT_NOBODY1);
            
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
            
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
            
curl_setopt($chCURLOPT_RETURNTRANSFER1);
            
// 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->fp4096))
        {
            if (
$this->debug) echo "<div class=\"r\">&lt;&lt;&lt; $data</div>\n";

            return 
$data;
        }
        else
        {
            return 
false;
        }
    }


    function 
_put($data)
    {
        
fwrite($this->fp$data);

        
$this->trID++;

        if (
$this->debug) echo "<div class=\"g\">&gt;&gt;&gt; $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;
        }
    }

}


?>
.... es solo saber interpretar el algoritmo para sacar lo que queramos de ahi...

Saludos.-

Yo lo probe y el error que me aparece es: Unable to connect to msn server
Error Connecting to the MSN Network
Ya cambien de usuario de contraeña todo pero no funciona, asi que no debe estar bien o no debe servir.
Saludos
  #13 (permalink)  
Antiguo 07/09/2007, 17:44
(Desactivado)
 
Fecha de Ingreso: diciembre-2006
Mensajes: 225
Antigüedad: 17 años, 4 meses
Puntos: 1
Re: Obtener lista contactos Messenger PHP

ninguno de esos cod's te van a funcionar si tienes el puerto bloqueado sea el puerto 1863
  #14 (permalink)  
Antiguo 03/12/2007, 13:26
Avatar de denied  
Fecha de Ingreso: octubre-2005
Ubicación: Barcelona - España
Mensajes: 52
Antigüedad: 18 años, 6 meses
Puntos: 0
Re: Obtener lista contactos Messenger PHP

Hola a todos, disculpen por reabrir este hilo.


Pero yo probé a ejecutar el codigo mencionado para obtener la lista de contactos del hotmail y con el puerto 1863 tcp/upd (ambos por si acaso) abiertos y nadaa

sigue dando me auth failed...

Alguien lo ha conseguido ?? podrian guiarme un poco en esto.

Muchas gracias
__________________
Retroceder Nunca, Rendirse Jamas
===============================
  #15 (permalink)  
Antiguo 04/12/2007, 16:15
 
Fecha de Ingreso: abril-2004
Mensajes: 39
Antigüedad: 20 años
Puntos: 2
Re: Obtener lista contactos Messenger PHP

Uhm en teoria y hasta dónde yo sé ... MSN Messenger és una aplicación cerrada, de protocolo cerrado ... y corríjanme si me equivoco, pero para poder comunicarse con el servidor d Messenger no haria falta alguna aplicación de terceros?

Saludos!
__________________
Caiman Systems - Diseño y programación de aplicaciones de gestión y páginas web
  #16 (permalink)  
Antiguo 04/12/2007, 16:22
 
Fecha de Ingreso: noviembre-2002
Mensajes: 1.341
Antigüedad: 21 años, 5 meses
Puntos: 17
Re: Obtener lista contactos Messenger PHP

En éste caso las aplicaciones de terceros serían las clases que están puestas arriba.

No lo he probado, pero técnicamente sí que es posible, por muy "cerrado" que sea el protocolo, es una comunicación TCP y se puede emular. De hecho hay muchos clientes para conectarse al messenger y utilizan su propia implementación del protocolo.
  #17 (permalink)  
Antiguo 05/12/2007, 08:50
Avatar de denied  
Fecha de Ingreso: octubre-2005
Ubicación: Barcelona - España
Mensajes: 52
Antigüedad: 18 años, 6 meses
Puntos: 0
De acuerdo Re: Obtener lista contactos Messenger PHP

Muchas gracias, igualmente he seguido buscando y ya he conseguido realizarlo.

Por lo cual puedo decir que si se puede, lo he conseguido con MSN y GMAIL

El codigo es de otra pagina, pero es muy parecido al expresado aquí.

De igual manera he de decir que el que me saca el listado de la cuenta GMAIl, funciona a la primera, cosa que con la del MSN no es asi, hay que insistirle con el F5 o actualizar y de ves en cuando si que es verdad que te muestra todos tus contactos y es más, de cierra sesión del MSN Messenger por si lo tuvieras abierto.

Ah y por cierto, si alguién desea el codigo, no tiene más que decirmelo.

Saludos a todos !!
__________________
Retroceder Nunca, Rendirse Jamas
===============================
  #18 (permalink)  
Antiguo 05/12/2007, 09:04
Avatar de kokecola2k2  
Fecha de Ingreso: febrero-2004
Mensajes: 130
Antigüedad: 20 años, 1 mes
Puntos: 0
Re: Obtener lista contactos Messenger PHP

puedes poner el codigo de gmail?
Y es verdad, con del de MSN funciona pero hay que intentarlo varias veces (y si tienes muuuchos contactos ni intentandolo 10000 veces).
Saludos
__________________
Gracias a los que me ayudaron, y a los que me ayudarán
  #19 (permalink)  
Antiguo 06/12/2007, 18:54
Avatar de denied  
Fecha de Ingreso: octubre-2005
Ubicación: Barcelona - España
Mensajes: 52
Antigüedad: 18 años, 6 meses
Puntos: 0
De acuerdo Re: Obtener lista contactos Messenger PHP

Hola de nuevo,

Aquí os pego el script necesario para conectarse al MSN y Gmail y conseguir el listado de contactos, que sea mostrado en una siguiente pagina y ademas consigamos seleccionar a todos los contactos a quienes les deseamos enviar un mesaje.

El codigo esta completo, debeis activar la extensión php_curl en el archivo php.ini

El codigo para MSN, no funciona correctamente, funciona pero no al 100%, es lo unico que he podido conseguir, el de Gmail si que funciona perfectame.

A continuación el codigo:



get_details.php
Código PHP:
<HTML>
<
HEAD>
</
HEAD>
<
BODY>
<
table border="1">
<
tr>
<
TD>
        <!-- 
Login form -->
        <
form method="post" action="choose_contacts.php">
        <
table>
        <
tr>
        <
td>Username</td><td><input type="text" name="username" /></td>
        </
tr>
        <
tr>
        <
td>Password</td><td><input type="password" name="password" /></td>
        </
tr>
        <
tr>
        <
td colspan="2">Choose the service you wish to connect to.</td>
        </
tr>
        <
tr>
        <
td>MSN Messenger:<br /><input type="radio" name="service" value="msn" /></td>
        <
td>Gmail: <br /><input type="radio" name="service" value="gmail" /></td>
        </
tr>
        <
tr>
        <
td colspan="2"><input type="submit" value="Get contacts" /></td>
        </
tr>
        </
table>
        </
form>
</
TD>
<
TD>
        <!-- 
Important notes on the completion of the form -->
        <
b><p>
        
Contacts will not be immediately contacted
        
You will have an opportunity to select which of your contacts you wish to
        send an email to in the next page
.
        </
p></b>
</
TD>
</
TR>
<
TR>
<
td colspan="2">
        <!-- 
Description of what the tool does -->
        <
p>
        
This tool will allow you to get your contacts from either your Gmail account or
        
your MSN messenger account.  Your contacts will be displayed and you will be able to
        choose which contacts you want to email before any emails are sent
.
        </
p>
        <
p>
        
To grab your contacts from MSN messenger enter your full email in the username fieldyour password
        in the password field 
and then select MSN messenger.
        </
p>
        <
p>
        
To grab your contacts from Gmail enter your username (the part of your email address
        before the 
'@' symbolin the username fieldyour password in the password field and then
        select Gmail
.
        </
p>
</
td>
</
tr>
</
TABLE>
</
BODY>
</
HTML
choose_contacts.php
Código PHP:
<?PHP

//Get contacts

if((isset($_POST['username'])) && (isset($_POST['password']))) {
        
//Check to ensure that a username and password have been supplied
       
        
if($_POST['service'] == "msn") {
                
//The service is msn
               
                
include('msn_contact_grab.class.php');

                
$msn2 = new msn;

                
$returned_emails $msn2->qGrab($_POST['username'], $_POST['password']);
        }
        elseif(
$_POST['service'] == "gmail") {
                
//The service is gmail
               
                
include('libgmailer.php');
               
                
$gmailer = new GMailer();
                if (
$gmailer->created) {
                        
$gmailer->setLoginInfo($_POST['username'], $_POST['password'], 0);

                        
//uncomment if you need it
                        //$gmailer->setProxy("proxy.company.com");

                        
if ($gmailer->connect()) {
                                
// GMailer connected to Gmail successfully.
                                // Do something with it.

                                //Get the contacts
                                // For "Inbox"

                                
$gmailer->fetchBox(GM_CONTACT"all""");

                                
$snapshot $gmailer->getSnapshot(GM_CONTACT);


                                
//Outputs an array of the contacts
                                
$returned_emails $snapshot->contacts;

                               
                        } else {
                                die(
"Fail to connect because: ".$gmailer->lastActionStatus());
                        }
                } else {
                        die(
"Failed to create GMailer because: ".$gmailer->lastActionStatus());
                }
               
        }       
}


?>
<HTML>
<HEAD>


</HEAD>
<BODY>

<p>
Your contacts have been retrieved from the <?php echo $_POST['service']; ?> service.  Using the form below
you are able to choose which of your contacts you wish to be contacted.  Once you have made your
choices use the 'Send Emails' button to send an email to the contacts selected.
</p>

<form method="post" action="send_emails.php">
<table border="1">
<tr>
<td></td>
<td>Email</td>
<td>Name</td>
</tr>


<?PHP

//Create the form for all the emails returned from the contact list
if($_POST['service'] == "msn") {
       
        foreach(
$returned_emails as $row){
                echo 
"<tr>";
                echo 
'<td><input type="checkbox" name="emails[]" value="'.$row['0'].'" checked="checked"/></td>';
                echo 
'<td>'.$row['0'].'</td>';
                echo 
'<td>'.$row['1'].'</td>';
                echo 
"</tr>\n\n";
        };
}
elseif(
$_POST['service'] == "gmail") {
       
        foreach(
$returned_emails as $row){
                echo 
"<tr>";
                echo 
'<td><input type="checkbox" name="emails[]" value="'.$row['email'].'" checked="checked"/></td>';
                echo 
'<td>'.$row['email'].'</td>';
                echo 
'<td>'.$row['name'].'</td>';
                echo 
"</tr>\n\n";
        };
}

?>

</table>
<input type="submit" value="Send Emails" />
</form>
send_mails.php
Código PHP:
<?PHP

$subject 
"Some subject.";
$message "Hello Joe it's only me!";
$extra_header "From: [email protected]";

foreach (
$_POST['emails'] as $email){
               
        
mail($email$subject$message$extra_header);
       
}

echo 
"Emails sent.";

?>


Hasta aquí sería la aplicación necesaria, para pedir el email y password, luego seleccionar entre los contactos mostrados a los que deseamos enviarles el mensaje y el último fichero, realiza el envío a los contactos seleccionados.

Laslibrerías son demasiadas largas, para incluirlas en el post, si alguién las necesitara, pedirmelo por privado.Saludos a todos.
__________________
Retroceder Nunca, Rendirse Jamas
===============================

Última edición por denied; 23/01/2008 a las 11:50
  #20 (permalink)  
Antiguo 07/12/2007, 00:00
Avatar de kokecola2k2  
Fecha de Ingreso: febrero-2004
Mensajes: 130
Antigüedad: 20 años, 1 mes
Puntos: 0
Re: Obtener lista contactos Messenger PHP

Gracias :)
__________________
Gracias a los que me ayudaron, y a los que me ayudarán
  #21 (permalink)  
Antiguo 12/02/2008, 19:39
 
Fecha de Ingreso: febrero-2008
Mensajes: 3
Antigüedad: 16 años, 2 meses
Puntos: 0
Re: Obtener lista contactos Messenger PHP

Me podrian enviar las librerias de este ultimo codigo por favor? Lo he estado probando pero evidentemente me salia fallo en la linea 13 para msn y 22 para gmail. Mi correo es [email protected]

Muchas Gracias
  #22 (permalink)  
Antiguo 21/05/2008, 19:48
 
Fecha de Ingreso: mayo-2008
Mensajes: 47
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Obtener lista contactos Messenger PHP

alguien sabe como brindarles a mis usuarios para que se conecten al msm o hotmail desde mi web. tipo ebuddy.com
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Tema Cerrado

SíEste tema le ha gustado a 1 personas (incluyéndote)




La zona horaria es GMT -6. Ahora son las 14:49.