跳至内容
wiki
用户工具
登录
站点工具
工具
显示页面
修订记录
反向链接
最近更改
媒体管理器
网站地图
登录
最近更改
媒体管理器
网站地图
您的足迹:
分享:技术:微博:新浪短网址集成
本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
====== 新浪短网址集成 ====== ===== 准备 ===== 登录新浪微博开发整账号:cinvestors\_app@tebon.com.cn,选择审核过的应用,查看[应用信息-基本信息]下的App Key,用于下面接口调用 ===== 调API ===== <code java> String APP_KEY = "1570065866";//APP KEY String targetUrl = "http://www.cinvestors.com.cn/opmt-web/";//原始URL String sinaApiUrl = "http://api.t.sina.com.cn/short_url/shorten.json?source=" + APP_KEY + "&url_long=" + targetUrl;//SINA API URL String jsonStr = HttpClientUtils.getWebContentByGet(sinaApiUrl);//调用API System.out.println(jsonStr);//输出JSON串 </code> ===== 输出 ===== 结果中的url_short即为新浪短网址 <code> [{"url_short":"http://t.cn/RGKJv9Y","url_long":"http://www.cinvestors.com.cn/opmt-web/","type":0}] </code> ===== 验证 ===== 访问http://t.cn/RGKJv9Y,成功跳转到http://www.cinvestors.com.cn/opmt-web/
分享/技术/微博/新浪短网址集成.txt
· 最后更改: 2016/03/30 11:08 由
gxx
页面工具
显示页面
修订记录
反向链接
回到顶部