Windows Live provides great access with their APIs. Unfortunately, despite a MS-provided library, implementing the APIs in PHP was difficult when trying to import a user's contacts. This code easily imports Hotmail contacts in your PHP app. Just include
and call the function.
The main idea was to create a simple function call that, with two lines, can return an array with the data in a user's Live Contacts (same at Hotmail contacts). The two lines are (1) including the PHP file, which includes the other PHP files and (2) calling
the function. The function returns the array. This is customizable based on editing the Person class with new fields, and loading them once the XML returns (in the contacts_fn.php file) and changing the scope of the data returned (in the settings.php). The
index.php file shows how to use this code library.
Some notes worth mentioning:
- This is NOT an official Microsoft product. I am not affiliated with Microsoft. I just used their code and tried to make it easier for people to use the Contacts API with PHP.
- Since it's PHP, there is no "compiled" binary.
- You will need to register your app with Microsoft at https://msm.live.com/app/manage.aspx?wa=wsignin1.0 .
- Be sure to configure the config.xml before you deploy. This holds appID, password, return URL, and policy URL.
- The windowslivelogin.php file is a slightly modified version of what Microsoft provides.