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

搜狐微博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>



  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值