Skip to content

Instantly share code, notes, and snippets.

@jbhannah
Created May 23, 2011 05:14
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbhannah/986254 to your computer and use it in GitHub Desktop.
Save jbhannah/986254 to your computer and use it in GitHub Desktop.
Skype status PHP script for use with AJAX
<?php
header('Content-type: application/json');
if ( array_key_exists('username', $_GET) )
$user = $_GET['username'];
else
$user = "";
$curl = curl_init("http://mystatus.skype.com/${user}.num");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$n = curl_exec($curl);
if ( !is_numeric($n) )
$n = 0;
$s = array(1 => 'offline', 2 => 'online', 3 => 'away', 5 => 'do_not_disturb');
if ( array_key_exists($n, $s) )
$status = $s[$n];
else
$status = 'unknown';
echo json_encode(array("username" => $user, "status" => $status));
curl_close($curl);
?>
@chiragl
Copy link

chiragl commented May 27, 2016

hi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment