|
| ||
|
请求:向{:getroot(1)}index.php?m=Index&a=create发送post请求,发送数据包括url=长网址 返回:json格式的数据
请求:向{:getroot(1)}index.php?m=Index&a=create发送post请求,发送数据包括url=长网址&alias=自定义网址 返回:json格式的数据
请求:向{:getroot(1)}index.php?m=Index&a=query发送post请求,发送数据包括tinyurl=查询的短地址 返回:json格式的数据
示例程序:
生成短网址
<?php $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,"{:getroot(1)}index.php?m=Index&a=create"); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); $data=array('url'=>'http://shuijun.cc'); curl_setopt($ch,CURLOPT_POSTFIELDS,$data); $strRes=curl_exec($ch); curl_close($ch); $arrResponse=json_decode($strRes,true); if($arrResponse['status']==0) { /**错误处理*/ echo iconv('UTF-8','GBK',$arrResponse['err_msg'])."\n"; } /** tinyurl */ echo$arrResponse['tinyurl']."\n"; ?>
其他接口使用如上 抱歉,本站暂停提供api接口,具体请与网站管理员联系! |
|
| ©{:date('Y')} {$GLOBALS.cfg_webname} |