分享百度短网址生成工具和接口 mr.baidu.com/xxxxx
生活随笔
收集整理的這篇文章主要介紹了
分享百度短网址生成工具和接口 mr.baidu.com/xxxxx
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
由于過長的鏈接網址缺乏友好,導致用戶誤認為帶病毒的網站,所以網址過長的時候可以通過本軟件將過長的網站轉換為短網址,使連接更友好,并且避免由于過度使用自己網站的域名而被屏蔽。
生成的最終效果是:http://mr.baidu.com/xxxxx
百度短網址生成
1) 請求地址
https://api.70api.com/api/bdurl/
2) 調用方式:HTTP post/get
GET 接口方式:
https://api.70api.com/api/bdurl/?apiKey=ecf4a44467813651c7130eade545a753&url=http://baidu.com
3) 接口描述:
- 接口支持post/get
4) 請求參數:
POST參數:
| apiKey | ecf4a44467813651c7130eade545a753 | string | Y | - |
| url | http://baidu.com | string | Y | - |
5) 請求返回結果:
{"res": true,"code": 0,"msg": "成功","data": {"short_url": "https://mr.baidu.com/5FpZJKlMoo","long_url": "http://baidu.com","cache": 1},"timestamp": 1593774022 }6) 請求返回結果參數說明:
| res | string | Y | - | |
| code | string | Y | - | |
| msg | string | Y | - | |
| data | string | Y | - | |
| short_url | string | Y | - | |
| long_url | string | Y | - | |
| cache | string | Y | - | |
| timestamp | string | Y | - |
php代碼案例:
$api = 'https://api.70api.com/api/bdurl/?apiKey=ecf4a44467813651c7130eade545a753&url=http://baidu.com';$result = json_decode(file_get_contents($api), 1);if (!empty($result['data']) && !empty($result['data']['short_url'])) {echo '獲取成功: ' . $result['data']['short_url'];} else {echo '獲取失敗:' . (empty($result['msg']) ? '未知錯誤' : $result['msg']);}還有其他很多短網址接口 比如 新浪短網址,騰訊短網址,app.10086.cn的綠標短網址
以為以上分享對您有幫助!
總結
以上是生活随笔為你收集整理的分享百度短网址生成工具和接口 mr.baidu.com/xxxxx的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Mr. Ms. Mrs. M
- 下一篇: hive报错Execution Erro