吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2392|回复: 7
收起左侧

[其他转载] 推荐短网址接口

  [复制链接]
航航Winter 发表于 2020-9-21 11:29
本帖最后由 航航Winter 于 2020-9-21 20:25 编辑

具体接口'tcn','urlcn','t360','sinaurl','wurl','mrw','suoim','suonz','unu','gitio','surl','vurl','zz3','syam'
不会PHP的可以http://dwz.nyun.cc/这里生成
短网址问题反馈https://vurl.video.qq.com/FOoYYmfs
[PHP] 纯文本查看 复制代码
<?php
header("Content-Type:text/json; charset=utf-8");
$dwzapiall = array('tcn','urlcn','t360','sinaurl','wurl','mrw','suoim','suonz','unu','gitio','surl','vurl','zz3','syam');
$longurl = (isset($_GET['url'])) ?$_GET['url']:$_POST['url'];
$dwzapi = (isset($_GET['dwzapi'])) ?$_GET['dwzapi']:$_POST['dwzapi'];

if(!$longurl||!$dwzapi){
exit (returnMsg(-1, "生成失败", '参数不完整'));
}else if(strpos($longurl,".") == false){ 
exit (returnMsg(-1, "生成失败", 'URL格式错误'));
}if (!preg_match('/^http[s]?:\\/\\//', $longurl)) {
    $longurl = "http://" . $longurl;
    return true;
}

if (in_array($dwzapi, $dwzapiall)) {
$dwzurl = dwz($longurl,$dwzapi);
if($dwzurl){exit (returnMsg(0, "生成成功", $dwzurl));
}else{exit (returnMsg(-1, "生成失败", '接口生成失败'));}
}else{exit (returnMsg(-1, "生成失败", '短网址参数错误'));}

function dwz($longurl,$dwzapi)
{
    $url = 'http://api.nyun.cc/dwz/index.php?url='.urlencode($longurl).'&dwzapi='.$dwzapi;
    $result = curl($url);
    $arr = json_decode($result, true);
    $result = $arr['data'];
    if (!$result) {
    } else {
        return $result;
    }

}


function returnMsg($code, $msg, $data)
    {
        return json_encode(['code'=>$code, 'msg'=>$msg, 'data'=>$data], JSON_UNESCAPED_UNICODE);
    }
    

function curl($url, $method='GET', $params=array(), $getinfo=false)
    {
        $header = array();
        if(isset($params["header"])){
            $header = array_merge($header,$params["header"]);
        }
        $user_agent = empty($params["ua"]) ? 0 : $params["ua"] ;
        $ch = curl_init();                                                     
        curl_setopt($ch, CURLOPT_URL, $url);                                   
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
        if($params["ref"]){
            curl_setopt($ch, CURLOPT_REFERER, $params["ref"]);
        }
        if (array_key_exists('responseHeader', $params) && $params['responseHeader']) {
            curl_setopt($ch, CURLOPT_HEADER, true);
            curl_setopt($ch, CURLOPT_NOBODY, true);
        }else {
            curl_setopt($ch, CURLOPT_NOBODY, false);
        }
        curl_setopt($ch, CURLOPT_USERAGENT,$user_agent);                                                  
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                        
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);                       
        curl_setopt($ch, CURLOPT_TIMEOUT, 3600);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);                       
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);                       
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);                        
        curl_setopt($ch, CURLOPT_AUTOREFERER, true);                           
        curl_setopt($ch, CURLOPT_ENCODING, '');                        
        if($method == 'POST'){
            curl_setopt($ch, CURLOPT_POST, true);              
            curl_setopt($ch, CURLOPT_POSTFIELDS, $params["postData"]);               
        }
        $res = curl_exec($ch);
        if ($getinfo) {
            $data = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);
        }else {
            $data = $res;
        }
        curl_close($ch);                                                       
        return $data;
    }
    ?>

免费评分

参与人数 5吾爱币 +3 热心值 +5 收起 理由
a17245632 + 1 + 1 我很赞同!
huomavip + 1 谢谢分享,surl.cn是我的
wybaxin + 1 + 1 谢谢@Thanks!
星辰一枚 + 1 我很赞同!
5ud0 + 1 + 1 我很赞同!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

lichen218 发表于 2020-9-21 14:00
学到了谢谢 楼主
iflower 发表于 2020-9-21 14:34
星辰一枚 发表于 2020-9-21 15:33
cdtily 发表于 2020-9-21 15:54
学到了学到了,短网址很隐秘,谢谢分享
Cutejun 发表于 2020-9-21 15:58

学到了学到了,短网址很隐秘,谢谢分享
huomavip 发表于 2020-9-21 19:36
哈哈哈哈哈哈卧槽,我的 https://surl.cn 也被添加到了,谢谢分享
 楼主| 航航Winter 发表于 2020-9-21 20:15
huomavip 发表于 2020-9-21 19:36
哈哈哈哈哈哈卧槽,我的 https://surl.cn 也被添加到了,谢谢分享

幸识,都是TI界精英
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-7 07:57

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表