How to use Skype API to Detect Users Status
Php 19-Jul-2019

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

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.