OneDrive Developer Center (redirect)

Looking for the Live SDK?

OneDrive logo

The Live SDK 5.6 is now available

Find it on the OneDrive Dev Center, the new place to find samples, documentation, and other resources for integrating OneDrive into your app.
Choose your download

If you're using previous versions of the Live SDK, the Live SDK 5.5 reference is still available.

 locked
Getting contacts step by step with PHP

    Question

  • Hello developers,

    I'm trying to use the Windows Live Contacts API, but I'm stuck at the beginning. I've read all the documentation pages, but I still don't understand how to get a user's contacts. I tried to make a step by step plan for myself, but I still don't get it. I got the sample PHP code up and running, but do I need to extend example one or example two...?

    I would really appreciate any tips to help me!

    Thanks in advance,
    Yorick

    Wednesday, April 23, 2008 11:30 AM

Answers

  • Yorick,

     

    Thanks for posting!

     

    If you've gotten the sample code up and running, you should be nearly there! The next step typically is building a request to Contacts and processing the response.

     

    While I don't have an example of this in PHP, I know that Alex Media, one of the MVPs on this forum, created something. You can check it out at: http://wlid-da.alex-media-services.com/?utm_source=AlexMedia&utm_medium=Blog.

     

    Hopefully this provides you with the information you need. Please post again to let us know how things are progressing!

     

    Best Regards,

     

    Dave

     

    Thursday, April 24, 2008 2:40 PM
  • A look in the address bar tells me that it's error 3004:

    3004

    Consent Service API failed in the <method name> method. The site requesting consent did not pass a valid application verifier.

    The offer security level requires that a valid application verifier be passed with the request.

     

    This means that you'll need to supply an application verifier before you can use this. I didn't get this on my own environment, have you set the 'requier app verifier' in the MSM by any chance to 1? If you did, change it to 0.

    Thursday, April 24, 2008 4:07 PM

All replies

  • Yorick,

     

    Thanks for posting!

     

    If you've gotten the sample code up and running, you should be nearly there! The next step typically is building a request to Contacts and processing the response.

     

    While I don't have an example of this in PHP, I know that Alex Media, one of the MVPs on this forum, created something. You can check it out at: http://wlid-da.alex-media-services.com/?utm_source=AlexMedia&utm_medium=Blog.

     

    Hopefully this provides you with the information you need. Please post again to let us know how things are progressing!

     

    Best Regards,

     

    Dave

     

    Thursday, April 24, 2008 2:40 PM
  • As Dave said above, take a look at my code. It's freely downloadable, and I think it's pretty self-explanatory.

     

    Basically, what it does after authentication, is this:

    - Open a cURL-session

    - Throw in the dt-header

    - Get the contacts-list

    - Parse it with an XPath-query

     

    The results are shown on screen, if you want it to. You can just iterate over that (I did a print_r).

     

    Good luck with it, if you have any questions, feel free to ask Smile

    Thursday, April 24, 2008 3:37 PM
  • Wow thanks for the great posts! It's exactly what I'm looking for! Thans for helping me so far already.

     

    I tried to get your example code running Alex, but I keep getting an error page that my domain is not allowed to use this service. I hosted it over here:

    http://www.yorickb.nl/windows_live_contacts_grabber/

     

    And registered an application with the following details:

    Application Name: YorickB Contact Grabber

    Return URL: http://www.yorickb.nl/windows_live_contacts_grabber/livedelegation-handler.php

    Domain Name www.yorickb.nl

    Secret Key: same as in Application-Key.xml

    Application verifier required: 1

     

    And Application-Key.xml:

    Code Snippet

    <windowslivelogin>
      <appid>00163FFF8000E3F4</appid>
      <secret>same secret key again</secret>
      <securityalgorithm>wsignin1.0</securityalgorithm>

      <returnurl>http://www.yorickb.nl/windows_live_contacts_grabber/livedelegation-handler.php</returnurl>
      <policyurl>http://www.yorickb.nl/windows_live_contacts_grabber/privacy.html</policyurl>
    </windowslivelogin>

     

     

    Any idea what I'm doing wrong? (Thanks for all the help you guys already gave!)
    Thursday, April 24, 2008 4:01 PM
  • A look in the address bar tells me that it's error 3004:

    3004

    Consent Service API failed in the <method name> method. The site requesting consent did not pass a valid application verifier.

    The offer security level requires that a valid application verifier be passed with the request.

     

    This means that you'll need to supply an application verifier before you can use this. I didn't get this on my own environment, have you set the 'requier app verifier' in the MSM by any chance to 1? If you did, change it to 0.

    Thursday, April 24, 2008 4:07 PM

  • Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/YorickB/domains/yorickb.nl/public_html/windows_live_contacts_grabber/contacts.php:47 Stack trace: #0 /home/YorickB/domains/yorickb.nl/public_html/windows_live_contacts_grabber/contacts.php(47): SimpleXMLElement->__construct('') #1 {main} thrown in /home/YorickB/domains/yorickb.nl/public_html/windows_live_contacts_grabber/contacts.php on line 47
    Tuesday, April 29, 2008 7:23 AM
  • We just talked about this problem via Messenger, I think this is somehow related to your account, as the XML received from the server is empty.

    Tuesday, April 29, 2008 1:11 PM
  • Any more news on that last problem? Because I got the same error when I test your code, and when i try my own code the only response i get from livecontacts.services.live.com is a completely empty page and a $curlinfo which is just 1 value, false.

    Im pretty sure I do have enough contacts and by using on of the previous methods I used (letting the user login through my own site) I did have positive results.
    Tuesday, July 15, 2008 2:36 PM
  • Have you also tried my updated sample, which can be found op http://happyfrog.alex-media-services.com?
    Tuesday, July 15, 2008 6:37 PM
  • I have now, thank you! That works. It seems to take the same steps as I did before, and at first I didnt get it to work either. But somewhere I must have changed a little thing that made it work. Thank you again

    Wednesday, July 16, 2008 11:50 AM
  • THANK YOU!
    I was having some curl troubles myself and you sharing this will be a big help. FYI though if I run that with no contacts I get a PHP error from the foreach, you might want to make that dumbie proofed by checking the array size or declaring the array.


    Wednesday, July 16, 2008 2:39 PM
  • i got my sample working, now proceeding to next step... but i'm lost.. how do i create a curl session and do all the xml parsing?

    the link is not working anymore.. anyone can post me the php file??. i need it for reference to retrieve contacts..haha

    thank you very much in advance

    Friday, August 29, 2008 9:12 AM
  • Hi,

    Can you tell me where can i find those php scripts that you were using for Windows Live Contacts

    All the links i found here are not found

    Is there a place where i can download them ?

    Thanks in advance


    Monday, February 14, 2011 3:43 PM
OneDrive Developer Center (redirect)

Looking for the Live SDK?

OneDrive logo

The Live SDK 5.6 is now available

Find it on the OneDrive Dev Center, the new place to find samples, documentation, and other resources for integrating OneDrive into your app.
Choose your download

If you're using previous versions of the Live SDK, the Live SDK 5.5 reference is still available.