您的位置:首页 > 其它

搜狐微博WAP第三方一键分享说明文档

2016-07-29 00:00 232 查看

搜狐微博WAP第三方一键分享说明文档

接口说明

1,请求URL:

http://w.sohu.com/t2/third/share.do

2,请求类型:

GET

3,请求参数:

url (必须)经过转码的url

title 编码之后的微博内容

appKey 你在开放平台注册的appKey

content 文字编码,当前页面的编码

picture 图片链接地址

returnURL 搜狐微博返回的你的网站url,没有的话,使用url 作为返回

详细解释:



url: 必须。分享页面的url,使用URLEncode UTF-8编码。

title:分享的内容,你可以随意填写内容,使用URLEncode UTF-8编码。

returnURL:搜狐微博返回的你的网站url,没有的话,使用url作为返回。一般不填。

picture:图片链接地址。

content:当你如果不指定title的时候,分享自动读取url页面的title标签内容作为title,并且使用content指定的编码解码title。

什么是appKey?

你可以通过对代码中AppKey进行设置,在你的网页使用一键分享功能并成功转播后,搜狐微博官方网页中你转播的信息将会带上你的网站名称,且可点击打开你的网站。



怎样申请AppKey?

请访问搜狐微博开放平台( http://open.t.sohu.com ),通过创建应用获取AppKey,如需显示来源,请在应用创建完成后,提交审核,我们会根据应用信息进行人工审核,审核通过后应用名称和应用网址将作为分享微博的来源信息。

简单的示例代码:

<script type="text/javascript">

function postToWb(){

varmtitle= document.getElementById("title").value;

varmurl= document.getElementById("url").value;

varappkey= document.getElementById("appkey").value;

varpicture= document.getElementById("picture").value;

varreturnURL= document.getElementById("returnURL").value;

var _t = encodeURIComponent(mtitle);

var _url = encodeURIComponent(murl);

var _returnurl= encodeURIComponent(returnURL ); //

var _appkey = encodeURI(appkey); //你从SOHU获得的appkey

var _pic = encodeURI(picture); //(例如:var _pic='图片url1|图片url2|图片url3....)

var _u = 'http://w.sohu.com/t2/third/share.do?url='+_url+'&appKey='+_appkey+'&picture='+_pic+'&title='+_t+'&returnURL='+_returnurl;

window.open( _u);

}

</script>

<title>第三方分享测试</title>

</head>

<body>

<div class="bCon">

<h1>第三方分享测试</h1>

title: <input type="text"id="title" style="width:400px" /><br/><br/>

url: <input type="text" id="url" style="width:400px"/><br/><br/>

appKey: <input type="text" id="appkey" style="width:400px"value="" /><br/><br/>

picture: <input type="text" id="picture" style="width:400px" /><br/><br/>

returnURL: <input type="text" id="returnURL"style="width:400px" /><br/><br/>

<a href="javascript:void(0)"onclick="postToWb();return false;" class="tmblog">

<img src="http://s2.cr.itc.cn/img/t/152.png"alt="分享到搜狐微博WAP" />

分享到搜狐微博WAP

</a>

</div>

</body>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: