是否仍然可以获得Skype的用户在线状态? [英] Is it still possible to get Skype's user online status?

查看:179
本文介绍了是否仍然可以获得Skype的用户在线状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所述,在API服务(发生较大变化)之后,仍然可以在Skype上检查用户的状态(在线,离线,忙碌...)吗?现在,开发人员"部分似乎非常有限: http://developer.skype.com/

As the title says, is it still possible to check a user's status (online, offline, busy...) on Skype after the (big) change in its API service? Developers section seems very very limited now: http://developer.skype.com/

推荐答案

是的.

有一些URL可以用来检测在线状态.

There are some urls wich can be used to detect the online status.

这会给出一个带有状态名称的文本(例如,离开或在线)

This gives a text with the statusname (e.g. away or online)

http://mystatus.skype.com/SKYPENAME.txt

这会为您提供一个数字化的Skype状态代码(请参见下面的列表)

This gives you a numeric skype statuscode (see list below)

http://mystatus.skype.com/SKYPENAME.num

这将提供一个包含数字状态代码和状态文本的xml输出 用不同的语言

This gives an xml output including numeric statuscode and statustext in diffent languages

http://mystatus.skype.com/SKYPENAME.xml

最后,您有显示不同状态图标图像的网址:

At last you have urls which show diffent status icon images:

用您喜欢的图像替换"smallicon"或"smallclassic". (可能的值:气球,大经典,小经典,smallicon, mediumicon,dropdown-white,dropdown-trans)

Replace "smallicon" or "smallclassic" with the image you like. (Possible values: balloon, bigclassic, smallclassic, smallicon, mediumicon, dropdown-white, dropdown-trans)

http://mystatus.skype.com/smallicon/SKYPENAME http://mystatus.skype.com/smallclassic/SKYPENAME http://mystatus.skype.com/SKYPENAME

在PHP中,最好的方法是使用我的函数:

In PHP The best way is to use my function:

  /**
   * @version: 1.0 (2014-05-13
   *
   * @param: String $username             Skype Username
   * @param: [String $lang]               Languagecode (possible values 2014-05-13: "en", "fr", "de","ja", "zh-cn", "zh-tw", "pt", "pt-br", "it", "es", "pl" , "pl"
   * @param: [String $img_time]           Typ im Status Image wich you like to show (Possible values: 2014-05-13: balloon, bigclassic, smallclassic, smallicon, mediumicon, dropdown-white, dropdown-trans)
   *
   * @return array                        "num" = Skype Statuscode, "text" = Statustext (Away" ect.), "img_url" url to Statuscode Image
   */
  function getSkypeStatus($username, $lang = "de", $img_type = "mediumicon")
  {
    $url = "http://mystatus.skype.com/".$username.".xml";
    $data = @file_get_contents($url);

    $status = array();
    if($data === false)
    {
      $status = array("num" =>0,
                      "text"=>"http error"
                );
      if(isset($http_response_header)) $status["error_info"] = $http_response_header;
    }
    else
    {
      $pattern = '/xml:lang="NUM">(.*)</';
      preg_match($pattern,$data, $match);

      $status["num"] = $match[1];

      $pattern = '/xml:lang="' . $lang .'">(.*)</';
      preg_match($pattern,$data, $match);

      $status["text"]    = $match[1];
      $status["img_url"] = "http://mystatus.skype.com/".$img_type."/".$username;
    }
    return $status;
  }

用法:

$status = getSkypeStatus("YourSkypeName"); // Minimal
$status = getSkypeStatus("YourSkypeName","de");  // with defined language for Statustext
$status = getSkypeStatus("YourSkypeName","de", "mediumicon"); // with specified image 

// to display status Icon:

echo '<img src="'.$status["img_url"].'" alt="'.$status["text"].'" title="'.$status["text"].'">';


// or if you like to do you own code for different status

switch($status["num"])
{
  case 7:
  case 2: echo "You are online"; break;
  default: echo "you are offline or in away state";
}

可能的状态消息(英文)为

Possible Status messages (in english) are

  • http错误:获取api数据时出错,例如互联网问题
  • 连接未知:未选择加入或没有可用数据.离线:
  • 用户脱机在线:用户脱机在线:
  • 该用户不可用:该用户不可用不要
  • 免打扰:用户为免打扰(DND)
  • 不可见:用户不可见或显示为脱机
  • Skype Me:用户位于Skype Me中 模式
  • http error: Error to get the api data e.g. problems with internet
  • connection Unknown: Not opted in or no data available. Offline:
  • The user is Offline Online: The user is Online Away:
  • The user is Away Not Available: The user is Not Available Do Not
  • Disturb: The user is Do Not Disturb (DND)
  • Invisible: The user is Invisible or appears Offline
  • Skype Me: The user is in Skype Me mode

可能的数字状态码:

  • 情况0 =未知
  • 情况1 =离线
  • 案例2 =在线
  • 情况3 =离开
  • 情况4 =不可用
  • 情况5 =请勿打扰
  • 情况6 =不可见
  • 案例7 = Skype Me

我认为这些信息来自以下主题: https://stackoverflow.com/a/16320950/2377961 https://stackoverflow.com/a/6426418/2377961

I god these informations from following threads: https://stackoverflow.com/a/16320950/2377961 https://stackoverflow.com/a/6426418/2377961

这篇关于是否仍然可以获得Skype的用户在线状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆