How to use Skype API to Detect Users Status
Skype is one of the biggest free VoIP (voice over internet protocol) service and an instant messaging client, currently developed and managed by Microsoft. Today I am going to show you that how you can check any Skype user’s status that he/she is online or off line. Its a very simple code I found on a website and want to share this with my readers.
PHP Code [source]
<?php function get_skype_status($username, $image = false, $icon = false ){ if($image && $icon) { return "http://mystatus.skype.com/smallicon/".$username; } //if you need image else if($image) { return "http://mystatus.skype.com/".$username; } //or just text else { $url = "http://mystatus.skype.com/".$username.".xml"; //getting contents $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($curl); curl_close($curl); $pattern = '/xml:lang="en">(.*)</'; preg_match($pattern,$data, $match); return $match[1]; } } ?>
This function accept 3 parameter $username, image and icon. If you nee only text status the no need to send 2nd and 3rd parameter send only username and it will give you text message. all 3 methods called below.
Function Call
<?php //getting skype status icon $ico = get_skype_status("huzoorbakhsh", true, true); echo "<p>Skype icon:</p>"; echo "<p><img src='".$ico."'/></p>"; //getting skype status image $image = get_skype_status("huzoorbakhsh", true); echo "<p>Skype image:</p>"; echo "<p><img src='".$image."'/></p>"; //getting skype status text $status = get_skype_status("huzoorbakhsh"); echo "<p>Skype status:</p>"; echo "<p>".$status."</p>"; ?>
These all methods show you icon, image and status text as we show in our demo page.
This is a very small script and easy to configure if you are looking for something like this then download its code for free and use it in your web projects.
I hope you like this please feel free to comment below your suggestion and problems if you face because we are here to solve your problems.
Tutorial Categories:
I don’t think it is correct tut. I am logged in, in skype and entering my username on the demo page in spite of this getting offline status,
You have to allow your online status its might be disabled in
Tools-> Options-> Privacy Settings. Screenshot also attached.
OK, I commented a few hours earlier about it wasnt working because of the new Changes on Skype. I have to take my words back because it is actually still working! Someone I know who have been working on skypes dev team told me that it wasnt working anymore! But I did give him a call about it and it turned out that we both had misunderstood eachother. What I found about why it isnt working right away after enabling the option from your Skype Privacy Settins page, is because skype needs a few hours or maybe upto 24 hours to process your change!
This only happens the first time you Enable it! Mine is now working, and when I change my Status and run the file it will immediately show my new Online Status ! So Well done PHPGANG for leaving this Thread Open.
Not Working !!!
Did you checked your privacy settings? Allowed your online status to be shown on the web?
DOES NOT WORK!!
Neither with “online status allowed on web” neither without
Hey anyone know why the code is not working anymore has the URL changed?