RTX的api開發實例
最近接觸了RTX的接口開發部份,RTX其實有很多玩法,除了可以用自帶的客戶端發消息之外還可以用PHP調用API的方式來做一些事情,下邊整理了一下分享給大家
值得提醒的是這些接口都需要設定通路權限不然通路時會提醒“IP受限制”
RTX Server強加了SDK通路安性,是以通過http方式通路cgi檔案需要在SDKProperty.xml添加遠端通路機器的IP位址,如下圖所示,允許192.168.10.100通過http方式通路cgi檔案
以下為所有接口的清單,你也可以通路這個地方來檢視相關的API http://rtx.tencent.com/sdk/
GetImage.cgi
擷取指定使用者的狀态圖檔
僅支援GET傳值
@param string receiver RTX使用者名
@return 使用者狀态圖檔
@example http://localhost:8012/GetImage.cgi?receiver=XXXX
GetMobile.cgi
擷取指定使用者的手機号碼
支援GET與POST傳值
@return 使用者手機
@example http://localhost:8012/GetMobile.cgi?receiver=XXXX
GetSession.cgi
擷取指定使用者的RTX session
@return RTX使用者session
@example http://localhost:8012/GetSession.cgi?receiver=XXXX
Login.php
判斷指定使用者ID與密碼是否存在RTXserver中
僅支援GET
@param string user RTX使用者名
@param string pwd RTX密碼
@return string 正确輸出true 使用者或密碼錯誤輸出false 參數缺失輸出params is null
@example http://localhost:8012/Login.php?user=XXXX&pwd=XXXX
SendIM.cgi
發送IM資訊
支援GET與POST傳值 參數順序随意
@param string sender 發消息人RTXid
@param string pwd 發送消息人RTX密碼
@param string receivers 接收人(多個接收人之間使用,隔開)
@param string msg 消息内容
@param string sessionid RTX session
@return string
@example http://localhost:8012/SendIM.cgi?sender=XXXX&pwd=XXX&receivers=A;B&msg=CS麼&sessionid=XXXX
SendNotify.cgi
發送通知資訊
@param string title 通知标題
@param string msg 通知内容
@param string receiver 接收人(多個接收人之間使用,隔開,若為空表示廣播)[option]
@param int delaytime 消息提醒框的停留時間(毫秒),0表示不自動消失
@param string okurl 成功後IE自動定位到指定的url 格式類似為:okurl=rtx.tencent.com 或者okurl=http://tx.tencent.com 注意:這裡的url必須為絕對位址[option]
@param string errurl 失敗後IE自動定位到指定的url[option]
@example http://localhost:8012/SendNotify.cgi?title=XXXX&msg=吃飯了&receiver=A;B&delaytime=2000
SendSMS.cgi
發送短信資訊
@param string msg 短信内容
@param string receiver 接收人(多個接收人之間使用,隔開)
@param string sender 發送人
SignAuth.cgi
驗證簽名 僅支援GET 參數順序随意
@param string user RTX使用者ID
@param string sign 簽名
@return string 成功為success! 失敗為failed!
@example http://localhost:8012/SignAuth.cgi?user=XXXX&sign=XXXX
getstatus.php
擷取使用者線上狀态僅支援GET
@param string username RTX使用者名
@return int 0不線上 1線上
@example http://localhost:8012/getstatus.php?username=XXXX
userlist.php
擷取所有使用者清單(隻含id與name)
@return string 使用者清單(json)
@example http://localhost:8012/userlist.php