開發API
发布时间:2026-09-25 | 浏览:1
<?php $apiurl = "https://ibf.tw/API/";//短網址API (請注意是大寫API) $url = "https://ibf.tw";//需要轉換的網址
$ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$apiurl); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost); $data = curl_exec($ch); curl_close($ch); $datas = json_decode($data , true); if($datas['status'] == 'success'){ //正確結果 $yes_url = $datas['shorturl'];//短網址 echo $yes_url; }else{ //這裡表示錯誤結果 $error_url = $datas['message']; } ?>