|
请求:向https://dwz1.cn/index.php?m=Index&a=create发送post请求,发送数据包括url=长网址 返回:json格式的数据
请求:向https://dwz1.cn/index.php?m=Index&a=create发送post请求,发送数据包括url=长网址&alias=自定义网址 返回:json格式的数据
请求:向https://dwz1.cn/index.php?m=Index&a=query发送post请求,发送数据包括tinyurl=查询的短地址 返回:json格式的数据
示例程序:
生成短网址
<?php $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,"https://dwz1.cn/index.php?m=Index&a=create"); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); $data=array('url'=>'http://dwz1.cn'); 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"; ?> 其他接口使用如上 |
|
©2021短网址 手机京东 || 京东领券 || 京东秒杀 |