短网址解析服务API接入说明
GET请求获取方式:
请求地址:http://www.kurl.fun/index/shortcute_url_api/get_api.html
请求参数:(url)http://www.kurl.fun/index/shortcute_url_api/get_api.html?url=这里是要缩短的网址
示例地址:http://www.kurl.fun/index/shortcute_url_api/get_api.html?url=https://www.baidu.com/
错误返回参数(json):
{"error":1} 短网址生成错误
{"error":2} 链接格式错误
成功返回参数(json):
{"url":"解析后的地址(因为是json格式所以需要转换)","error":null}
POST请求获取方式:
请求地址:http://www.kurl.fun/index/shortcute_url_api/post_api.html
请求参数:(url)要缩短的网址
PHP示例代码(用ajax的post请求也可以获取):
技术支持请联系QQ:2625080516
$url = ":http://www.kurl.fun/index/shortcute_url_api/post_api.html";//请求链接
$data= array ("url" => "https://www.jb51.net/article/34745.htm");//请求参数url必须
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// post数据
curl_setopt($ch, CURLOPT_POST, 1);
// post的变量
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
错误返回参数(json):
{"error":1} 短网址生成错误
{"error":2} 链接格式错误
成功返回参数(json):
{"url":"解析后的地址(因为是json格式所以需要转换)","error":null}
$data= array ("url" => "https://www.jb51.net/article/34745.htm");//请求参数url必须
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// post数据
curl_setopt($ch, CURLOPT_POST, 1);
// post的变量
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);