Monday 10 February 2014

Filled Under:

How to use Skype API to Detect Users Status in php

                 skype is a one of the biggest video calling, calling and instant messaging with client website in all over world. skype currently developed and managed by microsoft.in this post i have explained that how to i am getting my skype account status without skype login.



Try this code.

 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
  <head>  
   <title>How to use Skype API to Detect Online Users | Easyscript4u.blogspot.in</title>  
   <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />  
   <style type="text/css">  
    img {border-width: 0}  
    * {font-family:'Lucida Grande', sans-serif;}  
   </style>  
   <style>  
   #status  
   {  
     width: 357px;  
     height: 28px;  
     font-size: 15px;  
   }  
   </style>  
  </head>  
  <body>  
    <h2>How to use Skype API to Detect Online Users example.&nbsp;&nbsp;&nbsp;=> <a href="http://www.easyscript4u.blogspot.in/">Home</a> | <a href="http://easyscript4u.blogspot.in">More Demos</a></h2>  
 <?php  
 function get_skype_status($username, $image = false, $icon = false ){  
   //creating url  
   //if you need small icon  
   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];    
   }  
 }  
 $status = "";  
 if(isset($_POST['status']))  
 {  
   $ID = $_POST['status'];  
   //getting skype status icon  
   $ico = get_skype_status("$ID", true, true);  
   $status .= "<p>Skype icon:</p>";  
   $status .= "<p><img src='".$ico."'/></p>";  
   //getting skype status image  
   $image = get_skype_status("$ID", true);  
   $status .= "<p>Skype image:</p>";  
   $status .= "<p><img src='".$image."'/></p>";  
   //getting skype status text  
   $text = get_skype_status("$ID");  
   $status .= "<p>Skype status:</p>";  
   $status .= "<p>$text</p>";  
   $status = 'Your skype id: '.$ID.' status:<br>'.$status.'<br>';  
 }  
 echo $status.'  
   <form action="index.php" method="post">  
   <input type="text" name="status" id="status" placeholder="Skype Username" /><input type="submit" value="Get Status" style="padding: 5px;" />  
   <form>';  
 ?>  
  </body>  
 </html>  




3 comments: