腾讯短网址接口API-白嫖资源网

腾讯短网址接口API

其他就不多说了,有贡献送点贡献,没贡献给点评分也好!
调用方式:域名/你创建的文件.php?url=域名

 

<?php
header("Access-Control-Allow-Origin:*");
header('Content-type: application/json');
!empty($_GET['url']) ? $url = $_GET['url'] : exit(json_encode([
'code'=>202,
"msg"=>"请输入网址"
],JSON_UNESCAPED_UNICODE));
$link = myCurl('https://sa.sogou.com/gettiny?url='.$url);
function myCurl($data){
$ch = curl_init();     // Curl 初始化
$timeout = 30;     // 超时时间:30s
$ip = rand(1, 254) . '.' . rand(1, 254) . '.' . rand(1, 254) . '.' . rand(1, 254);
$UserAgent='Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36';
curl_setopt($ch, CURLOPT_URL, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_ENCODING, "");
curl_setopt($ch, CURLOPT_REFERER, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:'.$ip, 'CLIENT-IP:'.$ip));  //构造IP
curl_setopt($ch, CURLOPT_USERAGENT, $UserAgent);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}

exit (json_encode(array('code'=>'200','link'=>$link),JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE));
?>

 

白嫖资源网是一个优秀的资源网,极致体验,免费投稿还能赚钱!
白嫖资源网 » 腾讯短网址接口API

发表评论

白嫖资源网一个免费投稿赚钱的网站,唯一认准官网 BP.XFJ.ME

联系站长 投稿赚钱