您可以使用 JSONP 检索您的 Skype 状态吗? [英] Can you retrieve your Skype status using JSONP?

查看:45
本文介绍了您可以使用 JSONP 检索您的 Skype 状态吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道使用 JSONP 获取 Skype 状态的 URL 吗?

到目前为止,我只找到了一个 XML 状态 URL (http://mystatus.skype.com/username.xml).

(我正在尝试使用 AJAX 查询 Skype.是的,我可以使用服务器端代理脚本来突破跨域限制,但直接调用会很棒.)

西蒙.

解决方案

您可以将标题更改为JSONP"而不是 JSON.这就是你想要的.

JSONP 劫持了这样的跨域提取,无需服务器代理,通过在提取中携带数据.这就像我现在想到的最骇人听闻的有用技术.:)

我就此事向 Skype 抱怨 - 最简单的方法是让他们的服务器拥有一个官方的、记录在案的 JSONP 接口.我希望他们会这样做.

与此同时,这就是我解决问题的方法:

<块引用>

$enable_native = true;$valid_url_regex = '/^http:\/\/mystatus\.skype\.com\/myuserid.*/';

这允许它获取(通过在服务器上运行的 curl)mystatus.skype.com/myuserid.num(或 .txt)信息.

  • 使用 URL 从 JS 获取:
<块引用>

ba-simple-proxy.php?url=http%3A%2F%2Fmystatus.skype.com%2Fmyuserid.num&mode=native&full_status=1

就是这样.呼... :)

Does anyone know of a URL to get your Skype status using JSONP?

I've only found an XML status URL so far (http://mystatus.skype.com/username.xml).

(I'm trying to query Skype using AJAX. Yes, I could use a server-side proxy script to beat the cross-domain limits, but a direct call would be awesome.)

Simon.

解决方案

You might change the headline to 'JSONP' instead of JSON. That's what you want.

JSONP hijacks cross domain fetches like this to work, without server proxies, by carrying the data in fetches. It's like the most hackish useful technology I come to mind, right now. :)

I nagged Skype about this - the easiest way out would be for their servers to have an official, documented JSONP interface. I hope they'll do that.

In the mean time, this is how I got the problem solved:

$enable_native   = true;
$valid_url_regex = '/^http:\/\/mystatus\.skype\.com\/myuserid.*/';

This allows it to fetch (via curl running on the server) the mystatus.skype.com/myuserid.num (or .txt) information.

  • Fetching from JS with URL:

ba-simple-proxy.php?url=http%3A%2F%2Fmystatus.skype.com%2Fmyuserid.num&mode=native&full_status=1

That's it. Pheeew... :)

这篇关于您可以使用 JSONP 检索您的 Skype 状态吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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