88nb如無法滿足需求,可參考短網址聯盟內其他網址.https://ssur.cc/ 或 https://urlcc.cc/
88nb短網址api
請求限制:1次/秒
請求網址:https://88nb.cc/88nb-api.php
請求參數:
url:要縮短的網址
action:固定帶shorturl
timestamp:時間戳
signature:簽名參數利用key產生,等於時間戳加上key字串做md5.
回傳說明:若是產生成功則會再回傳json格式內的shorturl得到縮短後的網址
免費的key:ea8d7b3ded,b89377c881
,b6fc6a3133,44ccb4f4b2,120ef9330f
php範例-請把下列中ssur.cc替換成您要縮短的網址
$timestamp = time();
$signature = md5( $timestamp . 'ea8d7b3ded' );
$api_url = 'https://88nb.cc/88nb-api.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'url' => 'https://ssur.cc',
'format' => 'json',
'action' => 'shorturl',
'signature' => $signature,
'timestamp' => $timestamp
));
$data = curl_exec($ch);
curl_close($ch);
$data = json_decode( $data );
echo $data->shorturl;