Created
February 11, 2014 19:33
-
-
Save Shaz3e/8942389 to your computer and use it in GitHub Desktop.
How to use Skype API to Detect Online Users example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<title>How to use Skype API to Detect Online Users</title> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> | |
<style type="text/css"> | |
.inputbox{ | |
display: inline-block; | |
width: 50%; | |
height: 34px; | |
padding: 6px 12px; | |
font-size: 14px; | |
line-height: 1.428571429; | |
color: #555; | |
background-color: #fff; | |
background-image: none; | |
border: 1px solid #ccc; | |
border-radius: 4px; | |
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); | |
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); | |
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; | |
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; | |
} | |
.inputbox:focus{ | |
border-color: #66afe9; | |
outline: 0; | |
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); | |
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); | |
} | |
.button{ | |
display: inline-block; | |
padding: 6px 12px; | |
margin-bottom: 0; | |
font-size: 14px; | |
font-weight: normal; | |
line-height: 1.428571429; | |
text-align: center; | |
white-space: nowrap; | |
vertical-align: middle; | |
cursor: pointer; | |
-webkit-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
-o-user-select: none; | |
user-select: none; | |
background-image: none; | |
border: 1px solid transparent; | |
border-radius: 4px; | |
text-shadow: 0 -1px 0 rgba(0, 0, 0, .2); | |
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); | |
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); | |
text-shadow: 0 1px 0 #fff; | |
background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%); | |
background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%); | |
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0); | |
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); | |
background-repeat: repeat-x; | |
border-color: #dbdbdb; | |
border-color: #ccc; | |
} | |
.button:hover,.button:focus{ | |
color: #333; | |
text-decoration: none; | |
background-color: #e0e0e0; | |
background-position: 0 -15px; | |
} | |
.button:focus{ | |
outline: thin dotted; | |
outline: 5px auto -webkit-focus-ring-color; | |
outline-offset: -2px; | |
} | |
.button:active{ | |
background-image: none; | |
outline: 0; | |
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); | |
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); | |
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); | |
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); | |
background-image: none; | |
background-color: #e0e0e0; | |
border-color: #dbdbdb; | |
} | |
</style> | |
</head> | |
<body> | |
<h2>How to use Skype API to Detect Online Users example</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" class="inputbox" /> | |
<input type="submit" value="Get Status" class="button" /> | |
<form>'; | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment