Welcome Guest, Not a member yet? Register   Sign In
Fetch contacts from Hotmail
#7

[eluser]matt2012[/eluser]
Ive used the api at http://www.rapleaf.com/apidoc/v2/abook

You will need to get yourself an api key.

First page ask for email and password then post it to second page - call it contacts_list

then in the corresponding controller

Code:
function contacts_list()
    {
        if( isset($_POST['unm']) && isset($_POST['pwd']) )
        {
        $ch = curl_init();
        $unm = $_POST['unm'];
        $pwd = $_POST['pwd'];
        $url = "https://api.rapleaf.com/v2/abook/?api_key=YOUR_API_KEY_GOES_HERE&login;=".$unm."&password;=".$pwd;
        curl_setopt( $ch, CURLOPT_URL, $url);
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
        curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' );
        $result = curl_exec( $ch ); # run!
        curl_close($ch);
        if($result=='Login Failed: email address or password were incorrect' || $result=='Invalid login email address')
        {
        echo $result;
        }
        else
        {
        echo '<ul id="contacts">';
                $xml = new SimpleXMLElement($result);
                foreach ($xml->contact as $name)
                {
                echo '<li class="c1">' .  $name['name'] . ' ' . $name['email'] .  '</li>';
                }
        echo '<ul>';
        }
        }

Note this is a bit of a hack really you should use XML-RPC class but my initial attempt failed and this worked if someone does get this working with XML-RPC I would love to see it (maybe post it here).


Messages In This Thread
Fetch contacts from Hotmail - by El Forum - 01-31-2008, 05:01 AM
Fetch contacts from Hotmail - by El Forum - 01-31-2008, 05:04 AM
Fetch contacts from Hotmail - by El Forum - 01-31-2008, 08:50 AM
Fetch contacts from Hotmail - by El Forum - 01-31-2008, 10:36 AM
Fetch contacts from Hotmail - by El Forum - 02-20-2008, 03:35 PM
Fetch contacts from Hotmail - by El Forum - 02-20-2008, 04:39 PM
Fetch contacts from Hotmail - by El Forum - 02-20-2008, 04:48 PM
Fetch contacts from Hotmail - by El Forum - 02-20-2008, 08:17 PM
Fetch contacts from Hotmail - by El Forum - 02-21-2008, 12:24 PM
Fetch contacts from Hotmail - by El Forum - 02-21-2008, 12:24 PM
Fetch contacts from Hotmail - by El Forum - 02-21-2008, 12:44 PM
Fetch contacts from Hotmail - by El Forum - 10-10-2010, 01:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB