初始化

This commit is contained in:
muzihuaner
2026-03-14 23:26:53 +08:00
parent 30348c6dba
commit 6c5e43ae2d
59 changed files with 13770 additions and 0 deletions

1
.user.ini Normal file
View File

@@ -0,0 +1 @@
open_basedir=/www/wwwroot/api.quickso.cn/:/tmp/

View File

@@ -0,0 +1 @@
jlo6eRbUeedeaf4TXpk3zk-ptMPMj8wq-loTtuUftFE.2BgOJBH4ISD1D35mMMQjUU7ux_W-3jHrCMHqUAzgc4Y

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 muzihuaner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

89
api/360bz/index.php Normal file
View File

@@ -0,0 +1,89 @@
<?php
require ('../../need.php');//引用封装好的函数文件
$n = @$_REQUEST["n"];
$p = @$_REQUEST["p"];
$type = @$_REQUEST["type"];
if($n == '1'){
$form = '36';
}else
if($n == '2'){
$form = '6';
}else
if($n == '3'){
$form = '30';
}else
if($n == '4'){
$form = '9';
}else
if($n == '1'){
$form = '36';
}else
if($n == '5'){
$form = '15';
}else
if($n == '6'){
$form = '26';
}else
if($n == '7'){
$form = '11';
}else
if($n == '8'){
$form = '14';
}else
if($n == '9'){
$form = '5';
}else
if($n == '10'){
$form = '12';
}else
if($n == '11'){
$form = '10';
}else
if($n == '12'){
$form = '22';
}else
if($n == '13'){
$form = '16';
}else
if($n == '14'){
$form = '32';
}else
if($n == '15'){
$form = '35';
}else
if($n == '16'){
$form = '1';
}else{
$form = '26';
}
// echo 'http://wallpaper.apc.360.cn/index.php?c=WallPaper&a=getAppsByCategory&cid='.$form.'&start='.$p.'&count=200&from=360chrome';exit;
$p = mt_rand(1,10);
$data = need::teacher_curl('http://wallpaper.apc.360.cn/index.php?c=WallPaper&a=getAppsByCategory&cid='.$form.'&start='.$p.'&count=200&from=360chrome',[
'refer'=>' '
]);
//$JSON = JSON_decode($data
$num = preg_match_all('/"url":"(.*?)"/',$data,$date);
if(!$num){
if($type == 'text'){
exit('获取失败请重试');
}else{
exit(need::json(array('code'=>-1,'text'=>'获取失败请重试')));
}
}
$rand = mt_rand(0,$num-1);
$image = str_replace(['\\', 'http:'], ['', 'https:'], $date[1][$rand]);
/*
if(!stristr($image, 'ssl')){
$image = str_replace(['http://', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9'], ['https://', 'p1.ssl', 'p2.ssl', 'p3.ssl', 'p4.ssl', 'p5.ssl', 'p6.ssl', 'p7.ssl', 'p8.ssl', 'p9.ssl'], $image);
}
*/
if($type == 'text'){
exit($image);
}else
if($type == 'image'){
//$data = file_get_Contents($image);
need::send($image, 'location');
}else{
exit(need::json(array('code'=>1,'text'=>$image)));
}

1
api/60s/counter.dat Normal file
View File

@@ -0,0 +1 @@
10

46
api/60s/index.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat", "w");
fwrite($fp, $counter);
fclose($fp);
// 设置响应头为JSON格式
header('Content-Type: application/json; charset=utf-8');
// 定义要获取的API地址
$api_url = 'https://60s.viki.moe/v2/60s';
// 初始化cURL会话
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 跳过SSL证书验证仅用于测试
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // 设置超时时间
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // 跟随重定向
// 执行请求并获取响应
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
// 关闭cURL资源
curl_close($ch);
// 处理响应
if ($http_code === 200 && !empty($response)) {
// 直接返回获取到的内容
echo $response;
} else {
// 返回错误信息
http_response_code(500);
echo json_encode([
'error' => true,
'message' => '获取接口内容失败',
'http_code' => $http_code,
'curl_error' => $error ?: '无错误信息'
]);
}
?>

1
api/bing/counter.dat Normal file
View File

@@ -0,0 +1 @@
4

27
api/bing/index.php Normal file
View File

@@ -0,0 +1,27 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
header('Access-Control-Allow-Origin:*');
$str = file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
if ($str === false) {
exit('Failed to retrieve data from Bing');
}
$xml = simplexml_load_string($str);
if ($xml && isset($xml->image->url)) {
$imgurl = 'http://cn.bing.com' . $xml->image->url;
}
if(isset($imgurl) && $imgurl){
header('Content-Type: image/JPEG');
ob_end_clean();
readfile($imgurl);
flush(); ob_flush();
exit();
}else{
exit('error');
}
?>

1
api/douyin/counter.dat Normal file
View File

@@ -0,0 +1 @@
4

162
api/douyin/index.php Normal file
View File

@@ -0,0 +1,162 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
?>
<?php
/**
*@Author: JH-Ahua
* @CreateTime: 2025/8/5 下午2:13
*@email: admin@bugpk.com
*@blog: www.jiuhunwl.cn
*@Api: api.bugpk.com
*@tip: 抖音视频图集去水印解析
*/
header("Access-Control-Allow-Origin: *");
header('Content-type: application/json');
function douyin($url)
{
// 构造请求数据
$header = array('User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/122.0.0.0');
// 尝试从 URL 中获取视频 ID
$id = extractId($url);
// 检查 ID 是否有效
if (empty($id)) {
return array('code' => 400, 'msg' => '无法解析视频 ID');
}
// 发送请求获取视频信息
$response = curl('https://www.iesdouyin.com/share/video/' . $id, $header);
$pattern = '/window\._ROUTER_DATA\s*=\s*(.*?)\<\/script>/s';
preg_match($pattern, $response, $matches);
if (empty($matches[1])) {
return array('code' => 201, 'msg' => '解析数据失败' . $response);
}
$videoInfo = json_decode(trim($matches[1]), true);
if (!isset($videoInfo['loaderData'])) {
return array('code' => 201, 'msg' => '数据查找失败' . $response);
}
//替换 "playwm" 为 "play"
$videoResUrl = str_replace('playwm', 'play', $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['video']['play_addr']['url_list'][0]);
$imgurljson = $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['images'];
$imgurl = [];
if (is_array($imgurljson) && isset($imgurljson[0])) {
// 遍历 JSON 数组
foreach ($imgurljson as $item) {
// 检查当前元素是否包含 url_list 标签
if (isset($item['url_list']) && is_array($item['url_list']) && count($item['url_list']) > 0) {
// 将 url_list 的第一个值添加到 $imgurl 数组中
$imgurl[] = $item['url_list'][0];
}
}
}
if (!empty($videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['music'])) {
$music = array(
'title' => $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['music']['title'],
'author' => $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['music']['author'],
'avatar' => $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['music']['cover_large']['url_list'][0],
'url' => $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['video']['play_addr']['uri'],
);
}
if (empty($videoResUrl) && empty($imgurl)) {
$arr = array(
'code' => 404,
'msg' => '当前分享链接已失效!',
'data' => [],
);
} else {
// 构造返回数据
$arr = array(
'code' => 200,
'msg' => '解析成功',
'data' => array(
'author' => $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['author']['nickname'],
'uid' => $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['author']['unique_id'],
'avatar' => $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['author']['avatar_medium']['url_list'][0],
'like' => $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['statistics']['digg_count'],
'time' => $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]["create_time"],
'title' => $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['desc'],
'cover' => $videoInfo['loaderData']['video_(id)/page']['videoInfoRes']['item_list'][0]['video']['cover']['url_list'][0],
'images' => !empty($imgurl) ? $imgurl : '当前为短视频解析模式',
'url' => count($imgurl) > 0 ? '当前为图文解析,图文数量为:' . count($imgurl) . '张图片' : $videoResUrl,
'music' => $music ?? '音乐为视频原声',
)
);
}
return $arr;
}
function extractId($url)
{
$headers = get_headers($url, true);
if ($headers === false) {
// 如果获取头信息失败,直接使用原始 URL
$loc = $url;
} else {
// 处理重定向头可能是数组的情况
if (isset($headers['Location']) && is_array($headers['Location'])) {
$loc = end($headers['Location']);
} else {
$loc = $headers['Location'] ?? $url;
}
}
// 确保 $loc 是字符串
if (!is_string($loc)) {
$loc = strval($loc);
}
preg_match('/[0-9]+|(?<=video\/)[0-9]+/', $loc, $id);
return !empty($id) ? $id[0] : null;
}
function curl($url, $header = null, $data = null)
{
$con = curl_init((string)$url);
curl_setopt($con, CURLOPT_HEADER, false);
curl_setopt($con, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($con, CURLOPT_RETURNTRANSFER, true);
curl_setopt($con, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($con, CURLOPT_AUTOREFERER, 1);
if (isset($header)) {
curl_setopt($con, CURLOPT_HTTPHEADER, $header);
}
if (isset($data)) {
curl_setopt($con, CURLOPT_POST, true);
curl_setopt($con, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($con, CURLOPT_TIMEOUT, 5000);
$result = curl_exec($con);
if ($result === false) {
// 处理 curl 错误
$error = curl_error($con);
curl_close($con);
trigger_error("cURL error: $error", E_USER_WARNING);
return false;
}
curl_close($con);
return $result;
}
// 使用空合并运算符检查 url 参数
$url = $_GET['url'] ?? '';
if (empty($url)) {
echo json_encode(['code' => 201, 'msg' => 'url为空'], 480);
} else {
$response = douyin($url);
if (empty($response)) {
echo json_encode(['code' => 404, 'msg' => '获取失败'], 480);
} else {
echo json_encode($response, 480);
}
}
?>

1
api/dwzrec/counter.dat Normal file
View File

@@ -0,0 +1 @@
1

54
api/dwzrec/index.php Normal file
View File

@@ -0,0 +1,54 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
?>
<?php
header('Access-Control-Allow-Origin:*');
header('Content-type:application/json; charset=utf-8');
!empty($_GET['url']) ? $api = $_GET['url'] : exit(json_encode([
'code'=>202,
"msg"=>"网址不能为空"
],JSON_UNESCAPED_UNICODE));
/*
* 请求
*/
$json = myCurl($api);
/*
* 判断
*/
if($json){
echo json_encode(array('code'=>200,'dwz'=>$api,'rec'=>$json),JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
} else {
echo json_encode(array('code'=>201,'msg'=>'短网址还原失败'),JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
}
/***
* 万能短网址还原函数
* @param $url 短网址
* @return 原始网址 | 空(还原失败或非短网址)
*/
function myCurl($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0');
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_NOBODY, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 15);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_ENCODING, 'gzip');
$data = curl_exec($curl);
$curlInfo = curl_getinfo($curl);
curl_close($curl);
if($curlInfo['http_code'] == 301 || $curlInfo['http_code'] == 302) {
return $curlInfo['redirect_url'];
}
return '';
}

1
api/favicon/counter.dat Normal file
View File

@@ -0,0 +1 @@
3

74
api/favicon/index.php Normal file
View File

@@ -0,0 +1,74 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
header('Content-Type: image/x-icon');
if (!isset($_GET['url'])) {
header('HTTP/1.1 400 Bad Request');
exit('URL parameter is required');
}
$url = $_GET['url'];
// 自动补全协议前缀
if (!preg_match('/^https?:\/\//i', $url)) {
$url = 'https://' . $url;
}
if (!filter_var($url, FILTER_VALIDATE_URL)) {
header('HTTP/1.1 400 Bad Request');
exit('Invalid URL format');
}
$domain = parse_url($url, PHP_URL_HOST);
$scheme = parse_url($url, PHP_URL_SCHEME);
$faviconUrl = $scheme . '://' . $domain . '/favicon.ico';
// 尝试获取favicon最多重试3次
$maxRetries = 3;
$retryCount = 0;
$data = null;
$httpCode = 0;
do {
$ch = curl_init($faviconUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// 根据协议设置SSL验证
if (parse_url($faviconUrl, PHP_URL_SCHEME) === 'https') {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
curl_setopt($ch, CURLOPT_TIMEOUT, 5); // 5秒超时
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); // 3秒连接超时
$data = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
$retryCount++;
if ($httpCode === 200 && !empty($data)) {
break;
}
if ($retryCount < $maxRetries) {
sleep(1); // 等待1秒后重试
}
} while ($retryCount < $maxRetries);
if ($httpCode === 200 && !empty($data)) {
echo $data;
} else {
header('HTTP/1.1 404 Not Found');
exit('Favicon not found: ' . ($error ?? 'Unknown error'));
}
?>

1
api/ip/counter.dat Normal file
View File

@@ -0,0 +1 @@
7

129
api/ip/index.php Normal file
View File

@@ -0,0 +1,129 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
?>
<?php
// IP Geolocation API
header('Content-Type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
// Get IP from URL parameter or use visitor's IP
$ip = $_GET['ip'] ?? $_SERVER['REMOTE_ADDR'];
// Validate IP address
if (!filter_var($ip, FILTER_VALIDATE_IP)) {
http_response_code(400);
echo json_encode([
'status' => 'error',
'code' => 400,
'message' => 'Invalid IP address',
'ip' => $ip
]);
exit;
}
// Try multiple IP geolocation services for better reliability
$result = null;
$error = null;
// Method 1: Use ip.sb API
$url1 = "https://api.ip.sb/geoip/" . urlencode($ip);
$ch1 = curl_init();
curl_setopt($ch1, CURLOPT_URL, $url1);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch1, CURLOPT_TIMEOUT, 5);
curl_setopt($ch1, CURLOPT_USERAGENT, 'Mozilla/5.0');
$response1 = curl_exec($ch1);
$http_code1 = curl_getinfo($ch1, CURLINFO_HTTP_CODE);
curl_close($ch1);
if ($http_code1 == 200 && $response1) {
$data1 = json_decode($response1, true);
if ($data1 && isset($data1['ip'])) {
$result = [
'status' => 'success',
'code' => 200,
'ip' => $data1['ip'],
'country' => $data1['country'] ?? 'Unknown',
'country_code' => $data1['country_code'] ?? null,
'city' => $data1['city'] ?? 'Unknown',
'region' => $data1['region'] ?? 'Unknown',
'latitude' => $data1['latitude'] ?? null,
'longitude' => $data1['longitude'] ?? null,
'isp' => $data1['isp'] ?? 'Unknown',
'timezone' => $data1['timezone'] ?? null,
'asn' => $data1['asn'] ?? null,
'organization' => $data1['organization'] ?? null,
'type' => $data1['type'] ?? 'Unknown'
];
}
}
// Method 2: Fallback to ipapi.co if Method 1 fails
if (!$result) {
$url2 = "https://ipapi.co/" . urlencode($ip) . "/json/";
$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_URL, $url2);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2, CURLOPT_TIMEOUT, 5);
curl_setopt($ch2, CURLOPT_USERAGENT, 'Mozilla/5.0');
$response2 = curl_exec($ch2);
$http_code2 = curl_getinfo($ch2, CURLINFO_HTTP_CODE);
curl_close($ch2);
if ($http_code2 == 200 && $response2) {
$data2 = json_decode($response2, true);
if ($data2 && isset($data2['ip'])) {
$result = [
'status' => 'success',
'code' => 200,
'ip' => $data2['ip'],
'country' => $data2['country_name'] ?? 'Unknown',
'country_code' => $data2['country_code'] ?? null,
'city' => $data2['city'] ?? 'Unknown',
'region' => $data2['region'] ?? 'Unknown',
'latitude' => $data2['latitude'] ?? null,
'longitude' => $data2['longitude'] ?? null,
'isp' => $data2['org'] ?? 'Unknown',
'timezone' => $data2['timezone'] ?? null,
'postal' => $data2['postal'] ?? null,
'currency' => $data2['currency'] ?? null
];
}
}
}
// If both methods fail, return error
if (!$result) {
http_response_code(503);
$error_data = [
'status' => 'error',
'code' => 503,
'message' => 'Unable to fetch IP information from external services',
'ip' => $ip
];
// Support JSONP callback
if (!empty($_GET['callback'])) {
$callback = preg_replace('/[^a-zA-Z0-9_.]/', '', $_GET['callback']);
echo $callback . '(' . json_encode($error_data, JSON_UNESCAPED_UNICODE) . ');';
} else {
echo json_encode($error_data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
}
exit;
}
// Support JSONP callback
if (!empty($_GET['callback'])) {
header('Content-Type: application/javascript; charset=utf-8');
$callback = preg_replace('/[^a-zA-Z0-9_.]/', '', $_GET['callback']);
echo $callback . '(' . json_encode($result, JSON_UNESCAPED_UNICODE) . ');';
} else {
echo json_encode($result, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
}
?>

1
api/ipinfo/counter.dat Normal file
View File

@@ -0,0 +1 @@
5

BIN
api/ipinfo/font/msyh.ttf Normal file

Binary file not shown.

BIN
api/ipinfo/icon/ico/IP.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

BIN
api/ipinfo/icon/ico/bro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
api/ipinfo/img/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

501
api/ipinfo/index.php Normal file
View File

@@ -0,0 +1,501 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
class App
{
/*高德地图开发者key*/
private $key = 'b88cd7d0ad247b8cb9bdac4eae747bb9';
/*是否允许空refer0为不允许1为允许*/
public $referopen = "1";
/**路径 */
private $path = __DIR__ . "/";
// 浏览器信息
public $browser = null;
// 系统信息
public $os = null;
// 访问者IP
public $ip = null;
// 城市代码
public $adcode = null;
// 天气
public $weather = null;
// 图片
public $drawIm = null;
// 先定义一个数组
public $weekarray = array("", "", "", "", "", "", "");
// 城市
public $city = "";
// 省份
public $province = "";
// 初始化
public function init()
{
// 获取浏览器信息
$this->browser = $this->getBrowser();
// 获取系统信息
$this->os = $this->getOs();
// 访问者IP
$this->ip = $_SERVER["REMOTE_ADDR"];
// $this->ip = '222.216.222.168';
// 获取访问者信息
$this->getAddress();
// 绘制图片
$this->picInit()->setWeather()->setIcon()->setInfo();
//
return $this;
}
/**
* 设置信息
*/
public function setInfo()
{
/*基本项文字位置*/
//标语
$by_text = ""; //文字标语
$by_size = "12"; //文字大小
$by_angle = "0"; //角度
$by_x = "60";
$by_y = "45";
$by_font = $this->path . "font/msyh.ttf"; //字体位置
$by_color = imagecolorallocate($this->drawIm, 0, 51, 78); //这里可以自定义自己需要的颜色但需要转为RGB值可将0,51,78修改为自己需要的颜色的RGB值
//自定义文字
$diy_size = "20"; //文字大小
$diy_angle = "0"; //角度
$diy_x = "125";
$diy_y = "45";
$diy_font = $this->path . "font/msyh.ttf"; //字体位置
$diy_color = imagecolorallocate($this->drawIm, 0, 51, 78); //这里可以自定义自己需要的颜色但需要转为RGB值可将0,51,78修改为自己需要的颜色的RGB值
//日期
$time_size = "10"; //文字大小
$time_angle = "0"; //角度
$time_x = "167";
$time_y = "194";
$time_font = $this->path . "font/msyh.ttf"; //字体位置
$time_color = imagecolorallocate($this->drawIm, 0, 51, 78); //这里可以自定义自己需要的颜色但需要转为RGB值可将0,51,78修改为自己需要的颜色的RGB值
//位置
$local_size = "10"; //文字大小
$local_angle = "0"; //角度
$local_x = "165";
$local_y = "212";
$local_font = $this->path . "font/msyh.ttf"; //字体位置
$local_color = imagecolorallocate($this->drawIm, 0, 51, 78); //这里可以自定义自己需要的颜色但需要转为RGB值可将0,51,78修改为自己需要的颜色的RGB值
//IP
$ip_size = "10"; //文字大小
$ip_angle = "0"; //角度
$ip_x = "165";
$ip_y = "232";
$ip_font = $this->path . "font/msyh.ttf"; //字体位置
$ip_color = imagecolorallocate($this->drawIm, 0, 51, 78); //这里可以自定义自己需要的颜色但需要转为RGB值可将0,51,78修改为自己需要的颜色的RGB值
//系统
$system_size = "10"; //文字大小
$system_angle = "0"; //角度
$system_x = "278";
$system_y = "212";
$system_font = $this->path . "font/msyh.ttf"; //字体位置
$system_color = imagecolorallocate($this->drawIm, 0, 51, 78); //这里可以自定义自己需要的颜色但需要转为RGB值可将0,51,78修改为自己需要的颜色的RGB值
//浏览器
$bro_size = "10"; //文字大小
$bro_angle = "0"; //角度
$bro_x = "278";
$bro_y = "232";
$bro_font = $this->path . "font/msyh.ttf"; //字体位置
$bro_color = imagecolorallocate($this->drawIm, 0, 51, 78); //这里可以自定义自己需要的颜色但需要转为RGB值可将0,51,78修改为自己需要的颜色的RGB值
imagettftext($this->drawIm, $time_size, $time_angle, $time_x, $time_y, $time_color, $time_font, date('Y年n月j日') . " 星期" . $this->weekarray[date("w")]);
imagettftext($this->drawIm, $local_size, $local_angle, $local_x, $local_y, $local_color, $local_font, $this->province . '-' . $this->city);
imagettftext($this->drawIm, $by_size, $by_angle, $by_x, $by_y, $by_color, $by_font, $by_text); //标语添加到图片
$_diy = isset($_GET["diy"]) ? $_GET["diy"] : "";
imagettftext($this->drawIm, $diy_size, $diy_angle, $diy_x, $diy_y, $diy_color, $diy_font, base64_decode($_diy)); //自定义文字添加到图片
imagettftext($this->drawIm, $ip_size, $ip_angle, $ip_x, $ip_y, $ip_color, $ip_font, $this->ip); //IP添加到图片
imagettftext($this->drawIm, $system_size, $system_angle, $system_x, $system_y, $system_color, $system_font, $this->os); //系统添加到图片
imagettftext($this->drawIm, $bro_size, $bro_angle, $bro_x, $bro_y, $bro_color, $bro_font, $this->browser); //浏览器添加到图片
return $this;
}
/**
* 初始化画布
*/
public function picInit()
{
//背景图片名称(名称.格式,如"bg.png"
$dst_path = $this->path . 'img/bg.png';
//传递背景图片
$this->drawIm = imagecreatefromstring(file_get_contents($dst_path));
return $this;
}
/**
* 绘制天气部分
*/
public function setWeather()
{
/*基本图标位置*/
//天气图标位置
$weather_icon_x = "65";
$weather_icon_y = "50";
//天气图标
$sunny_path = $this->path . 'icon/weather/sunny.png';
$sunny_im = imagecreatefromstring(file_get_contents($sunny_path));
list($sunny_w, $sunny_h) = getimagesize($sunny_path);
$rain_path = $this->path . 'icon/weather/rain.png';
$rain_im = imagecreatefromstring(file_get_contents($rain_path));
list($rain_w, $rain_h) = getimagesize($rain_path);
$snow_path = $this->path . 'icon/weather/snow.png';
$snow_im = imagecreatefromstring(file_get_contents($snow_path));
list($snow_w, $snow_h) = getimagesize($snow_path);
$sha_path = $this->path . 'icon/weather/sha.png';
$sha_im = imagecreatefromstring(file_get_contents($sha_path));
list($sha_w, $sha_h) = getimagesize($sha_path);
$wu_path = $this->path . 'icon/weather/wu.png';
$wu_im = imagecreatefromstring(file_get_contents($wu_path));
list($wu_w, $wu_h) = getimagesize($wu_path);
$yin_path = $this->path . 'icon/weather/yin.png';
$yin_im = imagecreatefromstring(file_get_contents($yin_path));
list($yin_w, $yin_h) = getimagesize($yin_path);
$dyun_path = $this->path . 'icon/weather/dyun.png';
$dyun_im = imagecreatefromstring(file_get_contents($dyun_path));
list($dyun_w, $dyun_h) = getimagesize($dyun_path);
$unknow_path = $this->path . 'icon/weather/unknow.png';
$unknow_im = imagecreatefromstring(file_get_contents($unknow_path));
list($unknow_w, $unknow_h) = getimagesize($unknow_path);
// 判断天气
if (strpos($this->weather['weather'], '晴') !== false) {
imagecopy($this->drawIm, $sunny_im, $weather_icon_x, $weather_icon_y, 0, 0, $sunny_w, $sunny_h);
} elseif (strpos($this->weather['weather'], '云') !== false) {
imagecopy($this->drawIm, $dyun_im, $weather_icon_x, $weather_icon_y, 0, 0, $dyun_w, $dyun_h);
} elseif (strpos($this->weather['weather'], '阴') !== false) {
imagecopy($this->drawIm, $yin_im, $weather_icon_x, $weather_icon_y, 0, 0, $yin_w, $yin_h);
} elseif (strpos($this->weather['weather'], '雾') !== false) {
imagecopy($this->drawIm, $wu_im, $weather_icon_x, $weather_icon_y, 0, 0, $wu_w, $wu_h);
} elseif (strpos($this->weather['weather'], '雨') !== false) {
imagecopy($this->drawIm, $rain_im, $weather_icon_x, $weather_icon_y, 0, 0, $rain_w, $rain_h);
} elseif (strpos($this->weather['weather'], '雪') !== false) {
imagecopy($this->drawIm, $snow_im, $weather_icon_x, $weather_icon_y, 0, 0, $snow_w, $snow_h);
} elseif (strpos($this->weather['weather'], '风') !== false) {
imagecopy($this->drawIm, $sha_im, $weather_icon_x, $weather_icon_y, 0, 0, $sha_w, $sha_h);
} else {
imagecopy($this->drawIm, $unknow_im, $weather_icon_x, $weather_icon_y, 0, 0, $unknow_w, $unknow_h);
}
imagettftext($this->drawIm, 14, 0, 95, 140, imagecolorallocate($this->drawIm, 0, 51, 78), $this->path . "font/msyh.ttf", $this->weather['weather']); //今天天气添加到图片
imagettftext($this->drawIm, 13, 0, 160, 90, imagecolorallocate($this->drawIm, 0, 51, 78), $this->path . "font/msyh.ttf", '温度:' . $this->weather['temp'] . '℃'); //当前温度添加到图片
imagettftext($this->drawIm, 13, 0, 237, 90, imagecolorallocate($this->drawIm, 0, 51, 78), $this->path . "font/msyh.ttf", '湿度:' . $this->weather['humidity'] . '%RH'); //当前湿度添加到图片
imagettftext($this->drawIm, 11, 0, 160, 115, imagecolorallocate($this->drawIm, 0, 51, 78), $this->path . "font/msyh.ttf", '风向:' . $this->weather['winddirection'] . '方'); //当前风向添加到图片
imagettftext($this->drawIm, 11, 0, 237, 115, imagecolorallocate($this->drawIm, 0, 51, 78), $this->path . "font/msyh.ttf", '风力级别:' . $this->weather['windpower'] . '级'); //风力级别添加到图片
imagettftext($this->drawIm, 11, 0, 160, 135, imagecolorallocate($this->drawIm, 0, 51, 78), $this->path . "font/msyh.ttf", '更新时间:' . $this->weather['reporttime']); //更新时间添加到图片
return $this;
}
/**
* 绘制ICON
*/
public function setIcon()
{
//ip图标位置
$ip_icon_x = "150";
$ip_icon_y = "220";
//时间图标位置
$time_icon_x = "150";
$time_icon_y = "180";
//位置图标位置
$local_icon_x = "150";
$local_icon_y = "200";
//系统图标位置
$system_icon_x = "260";
$system_icon_y = "200";
//浏览器图标位置
$bro_icon_x = "260";
$bro_icon_y = "220";
//IP等图标
$ip_path = $this->path . 'icon/ico/IP.png';
$ip_im = imagecreatefromstring(file_get_contents($ip_path));
list($ip_w, $ip_h) = getimagesize($ip_path);
$time_path = $this->path . 'icon/ico/time.png';
$time_im = imagecreatefromstring(file_get_contents($time_path));
list($time_w, $time_h) = getimagesize($time_path);
$local_path = $this->path . 'icon/ico/local.png';
$local_im = imagecreatefromstring(file_get_contents($local_path));
list($local_w, $local_h) = getimagesize($local_path);
$system_path = $this->path . 'icon/ico/system.png';
$system_im = imagecreatefromstring(file_get_contents($system_path));
list($system_w, $system_h) = getimagesize($system_path);
$bro_path = $this->path . 'icon/ico/bro.png';
$bro_im = imagecreatefromstring(file_get_contents($bro_path));
list($bro_w, $bro_h) = getimagesize($bro_path);
//各图标位置
imagecopy($this->drawIm, $ip_im, $ip_icon_x, $ip_icon_y, 0, 0, $ip_w, $ip_h);
imagecopy($this->drawIm, $time_im, $time_icon_x, $time_icon_y, 0, 0, $time_w, $time_h);
imagecopy($this->drawIm, $local_im, $local_icon_x, $local_icon_y, 0, 0, $local_w, $local_h);
imagecopy($this->drawIm, $system_im, $system_icon_x, $system_icon_y, 0, 0, $system_w, $system_h);
imagecopy($this->drawIm, $bro_im, $bro_icon_x, $bro_icon_y, 0, 0, $bro_w, $bro_h);
return $this;
}
/**
* 合成输出图片
*/
public function suture()
{
header("Content-type: image/JPEG");
//输出
imagegif($this->drawIm);
imagedestroy($this->drawIm);
}
/**
* 获取IP及城市代码
*/
public function getAddress()
{
//获取IP及城市代码
$url = "http://restapi.amap.com/v3/ip?key=" . $this->key . "&ip=" . $this->ip;
$UserAgent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 3.5.21022; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_ENCODING, '');
curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($curl);
$data = json_decode($data, true);
$this->province = isset($data['province']) ? $data['province'] : "未知"; //省
$this->city = isset($data['city']) ? $data['city'] : "未知"; //市
$this->adcode = isset($data['adcode']) ? $data['adcode'] : ""; //城市代码
// 不为空获取天气信息
if ($this->adcode) {
$this->getWeather();
}
//
return $this;
}
/**
* 获取天气信息
*/
public function getWeather()
{
//获取天气信息
$tqurl = "http://restapi.amap.com/v3/weather/weatherInfo?key=" . $this->key . "&city=" . $this->adcode;
$UserAgent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 3.5.21022; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $tqurl);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_ENCODING, '');
curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$weatherinfo = curl_exec($curl);
$weatherinfo = json_decode($weatherinfo, true);
$this->weather['weather'] = $weatherinfo['lives']['0']['weather']; //天气
$this->weather['temp'] = $weatherinfo['lives']['0']['temperature']; //温度
$this->weather['humidity'] = $weatherinfo['lives']['0']['humidity']; //湿度
$this->weather['winddirection'] = $weatherinfo['lives']['0']['winddirection']; //风向
$this->weather['windpower'] = $weatherinfo['lives']['0']['windpower']; //风力级别
$this->weather['reporttime'] = $weatherinfo['lives']['0']['reporttime']; //更新时间
//
return $this;
}
/**
* 获取浏览器信息
*/
public function getBrowser()
{
$ua = $_SERVER['HTTP_USER_AGENT']; //获取用户代理字符串
if (preg_match('#(Camino|Chimera)[ /]([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Camino(' . $matches[2] . ')';
} elseif (preg_match('#SE 2([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = '搜狗(' . $matches[1] . ')';
} elseif (preg_match('#360([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = '360(' . $matches[1] . ')';
} elseif (preg_match('#QQ/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'QQ(' . $matches[1] . ')内置';
} elseif (preg_match('#Maxthon( |\/)([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Maxthon(' . $matches[2] . ')';
} elseif (preg_match('#Chrome/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Chrome(' . $matches[1] . ')';
} elseif (preg_match('#Safari/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Safari(' . $matches[1] . ')';
} elseif (preg_match('#opera mini#i', $ua)) {
$browser = 'Opera Mini(' . $matches[1] . ')';
} elseif (preg_match('#Opera.([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Opera(' . $matches[1] . ')';
} elseif (preg_match('#(j2me|midp)#i', $ua)) {
$browser = "J2ME/MIDP Browser";
} elseif (preg_match('/GreenBrowser/i', $ua)) {
$browser = 'GreenBrowser';
} elseif (preg_match('#TencentTraveler ([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = '腾讯TT(' . $matches[1] . ')';
} elseif (preg_match('#UCWEB([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'UCWEB(' . $matches[1];
} elseif (preg_match('#MSIE ([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Internet Explorer(' . $matches[1] . ')';
} elseif (preg_match('#avantbrowser.com#i', $ua)) {
$browser = 'Avant Browser';
} elseif (preg_match('#PHP#', $ua, $matches)) {
$browser = 'PHP';
} elseif (preg_match('#danger hiptop#i', $ua, $matches)) {
$browser = 'Danger HipTop';
} elseif (preg_match('#Shiira[/]([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Shiira(' . $matches[1] . ')';
} elseif (preg_match('#Dillo[ /]([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Dillo(' . $matches[1] . ')';
} elseif (preg_match('#Epiphany/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Epiphany(' . $matches[1] . ')';
} elseif (preg_match('#UP.Browser/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Openwave UP.Browser (' . $matches[1] . ')';
} elseif (preg_match('#DoCoMo/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'DoCoMo(' . $matches[1] . ')';
} elseif (preg_match('#(Firefox|Phoenix|Firebird|BonEcho|GranParadiso|Minefield|Iceweasel)/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Firefox(' . $matches[2] . ')';
} elseif (preg_match('#(SeaMonkey)/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Mozilla SeaMonkey(' . $matches[2] . ')';
} elseif (preg_match('#Kazehakase/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Kazehakase(' . $matches[1] . ')';
} else {
$browser = '未知';
}
return $browser;
}
/**
* 获取系统信息
*/
public function getOs()
{
$ua = $_SERVER['HTTP_USER_AGENT'];
$os = false;
if (preg_match('/Windows 95/i', $ua) || preg_match('/Win95/', $ua)) {
$os = "Windows 95";
} elseif (preg_match('/Windows NT 5.0/i', $ua) || preg_match('/Windows 2000/i', $ua)) {
$os = "Windows 2000";
} elseif (preg_match('/Win 9x 4.90/i', $ua) || preg_match('/Windows ME/i', $ua)) {
$os = "Windows ME";
} elseif (preg_match('/Windows.98/i', $ua) || preg_match('/Win98/i', $ua)) {
$os = "Windows 98";
} elseif (preg_match('/Windows NT 6.0/i', $ua)) {
$os = "Windows Vista";
} elseif (preg_match('/Windows NT 6.1/i', $ua)) {
$os = "Windows 7";
} elseif (preg_match('/Windows NT 5.1/i', $ua)) {
$os = "Windows XP";
} elseif (preg_match('/Windows NT 5.2/i', $ua) && preg_match('/Win64/i', $ua)) {
$os = "Windows XP 64 bit";
} elseif (preg_match('/Windows NT 5.2/i', $ua)) {
$os = "Windows Server 2003";
} elseif (preg_match('/Mac_PowerPC/i', $ua)) {
$os = "Mac OS";
} elseif (preg_match('/Windows Phone/i', $ua)) {
$os = "Windows Phone7";
} elseif (preg_match('/Windows NT 6.2/i', $ua)) {
$os = "Windows 8";
} elseif (preg_match('/Windows NT 10.0/i', $ua)) {
$os = "Windows 10";
} elseif (preg_match('/Windows NT 4.0/i', $ua) || preg_match('/WinNT4.0/i', $ua)) {
$os = "Windows NT 4.0";
} elseif (preg_match('/Windows NT/i', $ua) || preg_match('/WinNT/i', $ua)) {
$os = "Windows NT";
} elseif (preg_match('/Windows CE/i', $ua)) {
$os = "Windows CE";
} elseif (preg_match('/ipad/i', $ua)) {
if (preg_match("/(?<=CPU OS )[\d\_]{1,}/", $ua, $version)) {
$ver = str_replace('_', '.', $version[0]);
$os = "IOS(" . $ver . ")";
} else {
$os = "IOS";
}
} elseif (preg_match('/Touch/i', $ua)) {
$os = "Touchw";
} elseif (preg_match('/Symbian/i', $ua) || preg_match('/SymbOS/i', $ua)) {
$os = "Symbian OS";
} elseif (preg_match('/iPhone/i', $ua)) {
if (preg_match("/(?<=CPU iPhone OS )[\d\_]{1,}/", $ua, $version)) {
$ver = str_replace('_', '.', $version[0]);
$os = "IOS(" . $ver . ")";
} else {
$os = "IOS";
}
} elseif (preg_match('/PalmOS/i', $ua)) {
$os = "Palm OS";
} elseif (preg_match('/QtEmbedded/i', $ua)) {
$os = "Qtopia";
} elseif (preg_match('/Ubuntu/i', $ua)) {
$os = "Ubuntu Linux";
} elseif (preg_match('/Gentoo/i', $ua)) {
$os = "Gentoo Linux";
} elseif (preg_match('/Fedora/i', $ua)) {
$os = "Fedora Linux";
} elseif (preg_match('/FreeBSD/i', $ua)) {
$os = "FreeBSD";
} elseif (preg_match('/NetBSD/i', $ua)) {
$os = "NetBSD";
} elseif (preg_match('/OpenBSD/i', $ua)) {
$os = "OpenBSD";
} elseif (preg_match('/SunOS/i', $ua)) {
$os = "SunOS";
} elseif (preg_match('/linux/i', $ua)) {
$os = 'Linux';
if (preg_match('/Android.([0-9. _]+)/i', $ua, $matches)) {
$os = 'Android(' . $matches[1] . ')';
} elseif (preg_match('#Ubuntu#i', $ua)) {
$os = 'Ubuntu';
} elseif (preg_match('#Debian#i', $ua)) {
$os = 'Debian';
} elseif (preg_match('#Fedora#i', $ua)) {
$os = 'Fedora';
}
} elseif (preg_match('/Mac OS X/i', $ua)) {
$os = "Mac OS X";
} elseif (preg_match('/Macintosh/i', $ua)) {
$os = "Mac OS";
} elseif (preg_match('/Unix/i', $ua)) {
$os = "Unix";
} elseif (preg_match('#Nokia([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$os = "Nokia" . $matches[1];
} elseif (preg_match('/Mac OS X/i', $ua)) {
$os = "Mac OS X";
} else {
$os = '未知';
}
return $os;
}
}
// 执行
$app = new App();
if (empty($app->referopen)) {
die("配置错误!");
} else if ($app->referopen == 0) {
if (empty($_SERVER['HTTP_REFERER'])) {
die("请勿直接访问!");
}
} else if ($app->referopen == 1) {
$app->init()->suture();
} else {
die("未知错误!");
}

1
api/lishi/counter.dat Normal file
View File

@@ -0,0 +1 @@
2

88
api/lishi/index.php Normal file
View File

@@ -0,0 +1,88 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
?>
<?php
//允许跨域
header("Access-Control-Allow-Origin:*");
$month=date( 'm',time() );
$day=date( 'd',time() );
//当前年月日
$today = date('Y年m月d日');
//获取接口数据
$url="https://baike.baidu.com/cms/home/eventsOnHistory/".$month.'.json';
$data = httpGet($url);
$json = json_decode($data,true);
//统计当日总数
$countnum = count($json[$month][$month.$day])-1;
//获取输出数量(可以get调整)
$num = $_GET['num'] ? $_GET['num'] : $countnum;
$arr = array('code'=>'200','day'=>$today);
for ($x=0; $x<=$num; $x++) {
$arr['content'][$x].= match_chinese(strip_tags($json[$month][$month.$day][$x]['title']));
}
//创建随机数
$rand = rand(0,$countnum);
//下面是输出类型
if($_GET['format']=='json'){
//输出当日所有 类型为json
header('Content-type: application/json');
echo json_encode($arr,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
}elseif($_GET['format']=='js'){
//以js类型输出一条
header('Content-type: text/javascript;charset=utf-8');
echo 'function briefing(){document.write("'.$arr['content'][$rand].'");}';
}else{
//以html类型输出一条
header("Content-Type: text/html;charset=utf-8");
echo $arr['content'][$rand];
}
//下面是需要用到的封装
function httpGet($a, $b = '', $c = '', $d = ''){
//curl模拟get请求
$e = curl_init();
$f = mt_rand(11, 191) . "." . mt_rand(0, 240) . "." . mt_rand(1, 240) . "." . mt_rand(1, 240);
$i[] = "CLIENT-IP:" . $f;
$i[] = "X-FORWARDED-FOR:" . $f;
$i[] = "User-agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11";
$i[] = "X-Requested-With: XMLHttpRequest";
if (!empty($d)) {
$i[] = "Cookie: " . $d;
}
curl_setopt($e, CURLOPT_HTTPHEADER, $i);
curl_setopt($e, CURLOPT_RETURNTRANSFER, true);
curl_setopt($e, CURLOPT_TIMEOUT, 180);
curl_setopt($e, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($e, CURLOPT_SSL_VERIFYHOST, false);
if (!empty($c)) {
curl_setopt($e, CURLOPT_REFERER, $c);
}
if (!empty($b)) {
curl_setopt($e, CURLOPT_POST, 1);
curl_setopt($e, CURLOPT_POSTFIELDS, $b);
}
curl_setopt($e, CURLOPT_URL, $a);
curl_setopt($e, CURLOPT_ENCODING, "gzip");
$j = curl_exec($e);
curl_close($e);
return $j;
}
function match_chinese($chars,$encoding='utf8')
{
//清除正则
$pattern =($encoding=='utf8')?'/[\x{4e00}-\x{9fa5}a-zA-Z0-9]/u':'/[\x80-\xFF]/';
preg_match_all($pattern,$chars,$result);
$temp =join('',$result[0]);
return $temp;
}

1
api/mcstatus/counter.dat Normal file
View File

@@ -0,0 +1 @@
2

35
api/mcstatus/index.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
?>
<?php
header('Content-Type: application/json');
if (!isset($_GET['host'])) {
echo json_encode(['error' => 'Missing host parameter']);
exit;
}
$host = $_GET['host'];
$url = "https://api.mcstatus.io/v2/status/java/".urlencode($host);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode !== 200) {
echo json_encode(['error' => 'Failed to fetch server status']);
exit;
}
echo $response;
?>

1
api/qqimg/counter.dat Normal file
View File

@@ -0,0 +1 @@
1

23
api/qqimg/index.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
?>
<?php
error_reporting(E_ALL & ~E_NOTICE);
header('Content-Type: text/plain');
$qq = $_GET['qq'] ?? '';
if (is_numeric($qq) && $qq !== '') {
header('Cache-Control: public, max-age=86400');
header('Location: https://q1.qlogo.cn/g?b=qq&nk='.$qq.'&s=100');
} else {
http_response_code(400);
echo '缺少有效的QQ号码参数';
}
?>

1
api/qqzx/counter.dat Normal file
View File

@@ -0,0 +1 @@
1

42
api/qqzx/index.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
?>
<?php
error_reporting(E_ALL & ~E_NOTICE);
header('Content-Type: application/json');
$qq = $_GET['qq'] ?? '';
if (!is_numeric($qq) || empty($qq)) {
http_response_code(400);
exit(json_encode(['code' => 40, 'msg' => '缺少有效QQ号码参数']));
}
$context = stream_context_create(['http' => ['timeout' => 5]]);
$data = @file_get_contents("http://webpresence.qq.com/getonline?type=1&$qq:", false, $context);
if ($data === false) {
http_response_code(503);
exit(json_encode(['code' => 50, 'msg' => '服务暂时不可用']));
}
switch (trim($data)) {
case 'online[0]=0;':
$response = ['code' => 20, 'msg' => '电脑离线'];
break;
case 'online[0]=1;':
$response = ['code' => 21, 'msg' => '电脑在线'];
break;
default:
http_response_code(500);
$response = ['code' => 51, 'msg' => '未知状态'];
}
echo json_encode($response, JSON_UNESCAPED_UNICODE);
?>

1
api/qrcode/counter.dat Normal file
View File

@@ -0,0 +1 @@
1

3335
api/qrcode/index.php Normal file

File diff suppressed because it is too large Load Diff

1
api/sfz/counter.dat Normal file
View File

@@ -0,0 +1 @@
1

3706
api/sfz/index.php Normal file

File diff suppressed because it is too large Load Diff

1
api/sjbz/counter.dat Normal file
View File

@@ -0,0 +1 @@
3

45
api/sjbz/index.php Normal file
View File

@@ -0,0 +1,45 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
?>
<?php
if($_GET["method"] == "mobile"){
if($_GET["lx"] == 'dongman'){
$imgurl = 'http://api.btstu.cn/sjbz/api.php?method=mobile&lx=dongman';
}
else if($_GET["lx"] == 'meizi'){
$imgurl = 'http://api.btstu.cn/sjbz/api.php?method=mobile&lx=meizi';
}
else if($_GET["lx"] == 'fengjing'){
$imgurl = 'http://api.btstu.cn/sjbz/api.php?method=mobile&lx=fengjing';
}
else if($_GET["lx"] == 'suiji'){
$imgurl = 'http://api.btstu.cn/sjbz/api.php?method=mobile&lx=suiji';
}
else{
$imgurl = 'http://api.btstu.cn/sjbz/api.php?method=mobile&lx=dongman';
}
}else{
if($_GET["lx"] == 'dongman'){
$imgurl = 'http://api.btstu.cn/sjbz/api.php?lx=dongman';
}
else if($_GET["lx"] == 'meizi'){
$imgurl = 'http://api.btstu.cn/sjbz/api.php?lx=meizi';
}
else if($_GET["lx"] == 'fengjing'){
$imgurl = 'http://api.btstu.cn/sjbz/api.php?lx=fengjing';
}
else if($_GET["lx"] == 'suiji'){
$imgurl = 'http://api.btstu.cn/sjbz/api.php?lx=suiji';
}
else{
$imgurl = 'http://api.btstu.cn/sjbz/api.php?lx=dongman';
}
}
header("Location:".$imgurl);//跳转输出图片
?>

1
api/wyy/counter.dat Normal file
View File

@@ -0,0 +1 @@
7

203
api/wyy/index.php Normal file
View File

@@ -0,0 +1,203 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
header('Content-Type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
// 辅助类 - HTTP请求和数据处理
class NetEaseHelper {
/**
* 执行CURL请求
*/
public static function curl($url, $options = []) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
// 默认User-Agent
$ua = isset($options['ua']) ? $options['ua'] : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36';
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
// POST数据
if (!empty($options['post'])) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $options['post']);
}
// 自定义Headers
if (!empty($options['Header'])) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $options['Header']);
}
// SSL验证
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
/**
* 发送数据
*/
public static function send($data, $type = 'json') {
if ($type === 'json') {
if (is_array($data)) {
echo json_encode($data, JSON_UNESCAPED_UNICODE);
} else {
echo $data;
}
} else {
echo $data;
}
exit;
}
}
class Music_163_Rand {
protected $info = [];
protected $Array = [];
protected $Msg;
protected $id;
protected $header = [
'Host: music.163.com',
'Origin: http://music.163.com',
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
'Content-Type: application/x-www-form-urlencoded',
'Referer: http://music.163.com/search/',
];
public function __construct(Array $Array) {
foreach ($Array as $k => $v) {
$this->info[$k] = $v;
}
$this->ParameterException();
}
protected function ParameterException() {
$id = $this->info['id'];
if (!is_numeric($id)) {
$this->Array = ['code' => -1, 'msg' => '请输入正确的歌单id'];
$this->returns();
return;
}
$this->getPlaylistSongs();
}
protected function getPlaylistSongs() {
$id = $this->info['id'];
$post_data = http_build_query(['s' => '100', 'id' => $id, 'n' => '100', 't' => '100']);
$url = 'http://music.163.com/api/v6/playlist/detail';
$data = NetEaseHelper::curl($url, [
'post' => $post_data,
'ua' => 'NeteaseMusic/8.6.31.211201171945(8006031);Dalvik/2.1.0 (Linux; U; Android 11; PCLM10 Build/RKQ1.200928.002)',
'Header' => $this->header
]);
$decoded = json_decode($data, true);
if (empty($decoded['playlist']['trackIds'])) {
$this->Array = ['code' => -1, 'msg' => '无法获取歌单信息'];
$this->returns();
return;
}
$array = $decoded['playlist']['trackIds'];
$rand_song = $array[array_rand($array, 1)];
$this->id = $rand_song['id'];
$this->getSongDetail();
}
protected function getSongDetail() {
$id = $this->id;
$url = 'http://music.163.com/api/song/detail/?id=' . $id . '&ids=%5B' . $id . '%5D&csrf_token=';
$data = json_decode(NetEaseHelper::curl($url), true);
if (empty($data['songs'][0])) {
$this->Array = ['code' => -1, 'msg' => '无法获取歌曲信息'];
$this->returns();
return;
}
$song = $data['songs'][0];
$song_name = $song['name'] ?? '未知';
$artist_name = $song['artists'][0]['name'] ?? '未知';
$cover = $song['album']['picUrl'] ?? '';
$music_url = 'http://music.163.com/song/media/outer/url?id=' . $id;
$tail = $this->info['tail'] ?? '网易云音乐';
$this->Array = [
'code' => 200,
'msg' => '获取成功',
'data' => [
'id' => $id,
'song' => $song_name,
'singer' => $artist_name,
'cover' => $cover,
'music_url' => $music_url,
'tail' => $tail
]
];
$this->returns();
}
protected function returns() {
$type = $this->info['type'] ?? 'json';
switch ($type) {
case 'text':
if (isset($this->Array['data'])) {
$text = "歌曲:" . $this->Array['data']['song'] . "\n";
$text .= "歌手:" . $this->Array['data']['singer'];
echo $text;
} else {
echo $this->Array['msg'];
}
break;
case 'url':
if (isset($this->Array['data']['music_url'])) {
header('Location: ' . $this->Array['data']['music_url']);
} else {
echo json_encode($this->Array, JSON_UNESCAPED_UNICODE);
}
break;
default:
echo json_encode($this->Array, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
break;
}
exit;
}
}
// 获取参数
$songId = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$tail = isset($_REQUEST['tail']) ? $_REQUEST['tail'] : '网易云音乐';
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'json';
// 如果没提供歌单ID使用默认热门歌单
if (empty($songId) || $songId <= 0) {
$playlists = [71385702, 2884035, 3778678, 3779629, 19723756];
$songId = $playlists[array_rand($playlists, 1)];
}
// 执行查询
new Music_163_Rand([
'id' => $songId,
'type' => $type,
'tail' => $tail
]);
?>

1
api/yiyan/counter.dat Normal file
View File

@@ -0,0 +1 @@
2

3386
api/yiyan/hitokoto.txt Normal file

File diff suppressed because it is too large Load Diff

92
api/yiyan/index.php Normal file
View File

@@ -0,0 +1,92 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
?>
<?php
if ($_GET['charset']=='GBK' ||$_GET['charset']=='gbk' || $_GET['charset']=='gb2312'){
$array=file('hitokoto.txt');
$rand=rand(0,3388);
function utf8_to_gbk($str){
return mb_convert_encoding($str, 'gbk', 'utf-8');
}
$string=$array[$rand];
header('Content-Type: text/html; charset=GBK');
if ($_GET['code']==='js' || $_GET['code']==='javascript' || $_GET['code']==='JavaScript') {
header('Content-type: application/x-javascript; charset=GBK');
echo "function xjhitokoto(){document.write(\"";
echo trim(utf8_to_gbk($string)) . "\");}";
} elseif ($_GET['code']==='array' || $_GET['code']==='Array' || $_GET['code']==='arr' || $_GET['code']==='Arr') {
$arr = array(
'code' => 200 ,
'msg' => trim(utf8_to_gbk($string))
);
var_dump($arr);
}else{
echo trim(utf8_to_gbk($string));
}
}else{
$array=file('hitokoto.txt');
$rand=rand(0,3388);
$string=$array[$rand];
function arrayToXml($arr,$dom=null,$node=null,$root='xml',$cdata=false){
if (!$dom){
$dom = new DOMDocument('1.0','utf-8');
}
if(!$node){
$node = $dom->createElement($root);
$dom->appendChild($node);
}
foreach ($arr as $key=>$value){
$child_node = $dom->createElement(is_string($key) ? $key : 'node');
$node->appendChild($child_node);
if (!is_array($value)){
if (!$cdata) {
$data = $dom->createTextNode($value);
}else{
$data = $dom->createCDATASection($value);
}
$child_node->appendChild($data);
}else {
arrayToXml($value,$dom,$child_node,$root,$cdata);
}
}
return $dom->saveXML();
}
header('Content-Type: text/html; charset=UTF-8');
if ($_GET['code']==='js' || $_GET['code']==='javascript' || $_GET['code']==='JavaScript') {
header('Content-type: application/x-javascript; charset=UTF-8');
echo "function xjhitokoto(){document.write(\"";
echo trim($string);
echo "\");}";
} elseif ($_GET['code']==='json' || $_GET['code']==='JSON') {
header('Content-type: application/json; charset=UTF-8');
$json = json_encode(array(
'code' => 200 ,
'msg' => trim($string)
));
echo $json;
} elseif ($_GET['code']==='xml' || $_GET['code']==='XML') {
$xml = arrayToXml(array(
'msg' => trim($string)
));
echo $xml;
} elseif ($_GET['code']==='array' || $_GET['code']==='Array' || $_GET['code']==='arr' || $_GET['code']==='Arr') {
$arr = array(
'code' => 200 ,
'msg' => trim($string)
);
var_dump($arr);
}else{
echo trim($string);
}
}
?>

1
api/zhihu/counter.dat Normal file
View File

@@ -0,0 +1 @@
2

45
api/zhihu/index.php Normal file
View File

@@ -0,0 +1,45 @@
<?php
$counter = intval(file_get_contents("counter.dat"));
$_SESSION['#'] = true;
$counter++;
$fp = fopen("counter.dat", "w");
fwrite($fp, $counter);
fclose($fp);
// 设置响应头为JSON格式
header('Content-Type: application/json; charset=utf-8');
// 定义要获取的API地址
$api_url = 'http://news-at.zhihu.com/api/2/news/latest';
// 初始化cURL会话
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 跳过SSL证书验证仅用于测试
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // 设置超时时间
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // 跟随重定向
// 执行请求并获取响应
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
// 关闭cURL资源
curl_close($ch);
// 处理响应
if ($http_code === 200 && !empty($response)) {
// 直接返回获取到的内容
echo $response;
} else {
// 返回错误信息
http_response_code(500);
echo json_encode([
'error' => true,
'message' => '获取接口内容失败',
'http_code' => $http_code,
'curl_error' => $error ?: '无错误信息'
]);
}
?>

236
api_info.json Normal file
View File

@@ -0,0 +1,236 @@
{
"apis": [
{
"name": "Bing 每日壁纸",
"description": "获取Bing每日图片接口返回当日Bing首页背景图片",
"path": "/api/bing/index.php",
"method": "GET",
"params": []
},
{
"name": "抖音视频图集去水印",
"description": "通过抖音视频分享链接获取视频信息,返回标题、封面和播放地址",
"path": "/api/douyin/index.php",
"method": "GET",
"params": [
{
"name": "url",
"type": "string",
"required": true,
"description": "抖音视频分享链接"
}
]
},
{
"name": "短链接还原",
"description": "短链接还原",
"path": "/api/dwzrec/index.php",
"method": "GET",
"params": [
{
"name": "url",
"type": "string",
"required": true,
"description": "长链接"
}
]
},
{
"name": "网站图标获取",
"description": "通过网站域名获取其favicon.ico图标优先尝试HTTPS失败时回退到HTTP",
"path": "/api/favicon/index.php",
"method": "GET",
"params": [
{
"name": "url",
"type": "string",
"required": true,
"description": "目标网站域名"
}
]
},
{
"name": "IP签名档",
"description": "获取客户端、IP地址等信息以图片显示",
"path": "/api/ipinfo/index.php",
"method": "GET",
"params": []
},
{
"name": "历史上的今天",
"description": "获取当天历史上发生的重要事件",
"path": "/api/lishi/index.php",
"method": "GET",
"params": []
},
{
"name": "QQ头像获取",
"description": "通过QQ号码获取用户头像100像素尺寸",
"path": "/api/qqimg/index.php",
"method": "GET",
"params": [
{
"name": "qq",
"type": "number",
"required": true,
"description": "用户QQ号码"
}
]
},
{
"name": "QQ在线状态查询",
"description": "获取指定QQ号的电脑在线状态",
"path": "/api/qqzx/index.php",
"method": "GET",
"params": [
{
"name": "qq",
"type": "number",
"required": true,
"description": "用户QQ号码"
}
]
},
{
"name": "一言语录",
"description": "随机获取一句经典语录,支持多平台调用",
"path": "/api/yiyan/index.php",
"method": "GET",
"params": []
},
{
"name": "二维码生成",
"description": "生成指定内容的二维码图片接口",
"path": "/api/qrcode/index.php",
"method": "GET",
"params": [
{
"name": "text",
"type": "string",
"required": true,
"description": "需要生成二维码的文本内容"
},
{
"name": "size",
"type": "string",
"required": true,
"description": "二维码大小(大小为px,选填)"
}
]
},
{
"name": "随机壁纸",
"description": "获取随机壁纸图片接口",
"path": "/api/sjbz/index.php",
"method": "GET",
"params": [
{
"name": "method",
"required": false,
"type": "string",
"description": "输出壁纸端[mobile|pc|zsy]默认为pc"
},
{
"name": "lx",
"required": false,
"type": "string",
"description": "选择输出分类[meizi|dongman|fengjing|suiji],为空随机输出"
},
{
"name": "format",
"required": false,
"type": "string",
"description": "输出壁纸格式[json|images]默认为images"
}
]
},
{
"name": "身份证号信息查询",
"description": "查询身份证号码信息",
"path": "/api/sfz/index.php",
"method": "GET",
"params": [
{
"name": "card",
"type": "string",
"required": true,
"description": "身份证号码"
}
]
},
{
"name": "知乎日报",
"description": "每天 3 次,每次 7 分钟",
"path": "/api/zhihu/index.php",
"method": "GET",
"params": []
},
{
"name": "每日60s",
"description": "60s知天下事",
"path": "/api/60s/index.php",
"method": "GET",
"params": []
},
{
"name": "IP地址查询",
"description": "查询IP地址的地理位置信息",
"path": "/api/ip/index.php",
"method": "GET",
"params": [
{
"name": "ip",
"type": "string",
"required": false,
"description": "要查询的IP地址不提供则查询访问者IP"
},
{
"name": "callback",
"type": "string",
"required": false,
"description": "JSONP回调函数名"
}
]
},
{
"name": "Minecraft服务器状态查询",
"description": "查询Minecraft Java版服务器状态信息",
"path": "/api/mcstatus/index.php",
"method": "GET",
"params": [
{
"name": "host",
"type": "string",
"required": true,
"description": "Minecraft服务器地址"
}
]
},
{
"name": "网易云音乐随机歌曲",
"description": "从指定网易云歌单中随机获取歌曲信息,包括歌名、歌手、封面和播放链接",
"path": "/api/wyy/index.php",
"method": "GET",
"params": [
{
"name": "id",
"required": false,
"type": "integer",
"description": "网易云歌单ID不提供则使用默认热门歌单"
},
{
"name": "type",
"required": false,
"type": "string",
"description": "返回格式[json|text|url]默认为json。json返回完整信息text返回文本url直接重定向到音乐链接"
},
{
"name": "tail",
"required": false,
"type": "string",
"description": "自定义消息尾巴,默认为'网易云音乐'"
}
]
}
]
}

24
get-counter.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
header('Content-Type: application/json; charset=utf-8');
$totalCount = 0;
// 读取api目录下所有子目录的counter.dat文件
$apiDir = __DIR__ . '/api';
if (is_dir($apiDir)) {
$subdirs = scandir($apiDir);
foreach ($subdirs as $subdir) {
$counterFile = $apiDir . '/' . $subdir . '/counter.dat';
if (is_file($counterFile)) {
$count = intval(file_get_contents($counterFile));
$totalCount += $count;
}
}
}
// 返回JSON格式的调用次数
echo json_encode([
'count' => $totalCount,
'timestamp' => date('Y-m-d H:i:s')
]);
?>

383
index.php Normal file
View File

@@ -0,0 +1,383 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>快点API - 专业接口服务平台 | 免费API接口调用 | 数据接口服务</title>
<meta name="description" content="快点API提供稳定可靠的接口服务平台包含免费API接口调用、数据接口、开发接口等服务助力开发者快速构建应用。">
<meta name="keywords" content="API接口,免费API,数据接口,接口服务,开发接口,接口调用">
<!-- Bootstrap 5 CSS -->
<link href="https://gcore.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://gcore.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
<style>
:root {
--primary-color: #4361ee;
--secondary-color: #3f37c9;
--accent-color: #4cc9f0;
--light-color: #f8f9fa;
--dark-color: #212529;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f0f2f5;
}
.navbar {
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.hero-section {
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
color: white;
padding: 4rem 0;
margin-bottom: 2rem;
border-radius: 0 0 1rem 1rem;
}
.api-card {
transition: all 0.3s ease;
border: none;
border-radius: 1rem;
overflow: hidden;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.api-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}
.card-text {
max-height: 100px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.method-badge {
font-weight: bold;
border-radius: 0.5rem;
}
.btn-outline-primary {
border-radius: 0.5rem;
border: 2px solid var(--primary-color);
color: var(--primary-color);
}
.btn-outline-primary:hover {
background-color: var(--primary-color);
color: white;
}
.footer {
background-color: var(--dark-color);
color: white;
padding: 2rem 0;
}
.api-icon {
font-size: 2rem;
color: var(--accent-color);
margin-bottom: 1rem;
}
.stats-card {
background: white;
border-radius: 1rem;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
padding: 1.5rem;
text-align: center;
transition: transform 0.3s ease;
}
.stats-card:hover {
transform: translateY(-5px);
}
.stats-number {
font-size: 2rem;
font-weight: bold;
color: var(--primary-color);
}
.feature-icon {
width: 60px;
height: 60px;
background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 1rem;
color: white;
font-size: 1.5rem;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark sticky-top" style="background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));">
<div class="container">
<a class="navbar-brand d-flex align-items-center" href="/">
<i class="bi bi-lightning-charge fs-3 me-2"></i>
<span class="fw-bold">快点API</span>
</a>
<button class="navbar-toggler border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item mx-2">
<a class="nav-link" href="#">首页</a>
</li>
<!-- <li class="nav-item mx-2">
<a class="nav-link" href="#">API文档</a>
</li> -->
<!-- <li class="nav-item mx-2">
<a class="nav-link" href="#">价格</a>
</li> -->
<li class="nav-item mx-2">
<a class="nav-link" href="#footer-about">关于</a>
</li>
<!-- <li class="nav-item ms-2">
<a class="btn btn-outline-light btn-sm" href="#">登录</a>
</li> -->
</ul>
</div>
</div>
</nav>
<div class="hero-section">
<div class="container text-center">
<h1 class="display-4 fw-bold mb-3">专业API接口服务平台</h1>
<p class="lead mb-4">提供稳定可靠的接口服务,助力开发者快速构建应用</p>
<!-- <div class="d-flex justify-content-center gap-3">
<button class="btn btn-light btn-lg px-4">开始使用</button>
<button class="btn btn-outline-light btn-lg px-4">查看文档</button>
</div> -->
</div>
</div>
<div class="container">
<div class="row mb-5">
<div class="col-md-4 mb-4">
<div class="stats-card">
<div class="feature-icon">
<i class="bi bi-rocket"></i>
</div>
<div class="stats-number" id="api-count">0</div>
<p class="mb-0">可用API接口</p>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="stats-card">
<div class="feature-icon">
<i class="bi bi-lightning"></i>
</div>
<div class="stats-number" id="daily-calls">0</div>
<p class="mb-0">日调用次数</p>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="stats-card">
<div class="feature-icon">
<i class="bi bi-shield-check"></i>
</div>
<div class="stats-number">99.9%</div>
<p class="mb-0">服务可用性</p>
</div>
</div>
</div>
<div class="row mb-4">
<div class="col-lg-8">
<h2 class="mb-3">API接口列表</h2>
<p class="text-muted">提供各类实用API接口服务支持多种应用场景</p>
</div>
<div class="col-lg-4 d-flex align-items-end justify-content-lg-end">
<div class="input-group">
<input type="text" class="form-control" placeholder="搜索API..." id="search-api">
<button class="btn btn-outline-primary" type="button">
<i class="bi bi-search"></i>
</button>
</div>
</div>
</div>
<div class="row" id="api-container">
<?php
// 读取API信息JSON文件
$jsonFile = 'api_info.json';
$jsonContent = file_get_contents($jsonFile);
$apiData = json_decode($jsonContent, true);
$apis = $apiData['apis'] ?? [];
// 输出API卡片
foreach ($apis as $api) {
$apiId = 'api-' . md5($api['path']);
// Replace match expression with compatible array lookup
$methodMap = [
'GET' => 'bg-success',
'POST' => 'bg-primary',
'PUT' => 'bg-warning',
'DELETE' => 'bg-danger'
];
$methodClass = $methodMap[strtoupper($api['method'])] ?? 'bg-secondary';
// 获取当前网站URL组件
$scheme = $_SERVER['REQUEST_SCHEME'] ?? 'http';
$host = $_SERVER['HTTP_HOST'] ?? '';
$fullUrl = $scheme . '://' . $host . $api['path'];
// 读取调用次数
$relativePath = ltrim($api['path'], '/');
$counterFile = dirname($relativePath) . '/counter.dat';
$callCount = 0;
if (file_exists($counterFile)) {
$callCount = (int)trim(file_get_contents($counterFile));
}
?>
<div class="col-md-6 col-lg-4 mb-4">
<div class="card h-100 api-card shadow-sm">
<div class="card-body">
<div class="d-flex justify-content-between align-items-start mb-3">
<h5 class="card-title mb-0"><?php echo htmlspecialchars($api['name']); ?></h5>
<span class="badge <?php echo $methodClass; ?> method-badge"><?php echo htmlspecialchars($api['method']); ?></span>
</div>
<p class="text-muted mb-2">
<small><i class="bi bi-link-45deg"></i> <?php echo htmlspecialchars($fullUrl); ?></small>
</p>
<p class="text-muted mb-2">
<small><i class="bi bi-eye"></i> 调用次数: <?php echo $callCount; ?></small>
</p>
<div class="mt-3">
<h6 class="card-subtitle mb-2 text-muted">接口描述</h6>
<p class="card-text"><?php echo htmlspecialchars($api['description']); ?></p>
<?php if (!empty($api['params'])): ?>
<button class="btn btn-sm btn-outline-primary mb-2" type="button" data-bs-toggle="collapse" data-bs-target="#<?php echo $apiId; ?>-details" aria-expanded="false" aria-controls="<?php echo $apiId; ?>-details">
查看请求参数
</button>
<?php endif; ?>
<div class="collapse" id="<?php echo $apiId; ?>-details">
<?php if (!empty($api['params'])): ?>
<div class="mt-3">
<h6 class="card-subtitle mb-2 text-muted">请求参数</h6>
<ul class="list-group list-group-flush">
<?php foreach ($api['params'] as $param): ?>
<li class="list-group-item p-3">
<div class="d-flex justify-content-between align-items-start">
<code><?php echo htmlspecialchars($param['name']); ?></code>
<span class="badge <?php echo $param['required'] ? 'bg-danger' : 'bg-secondary'; ?>">
<?php echo $param['required'] ? '必填' : '可选'; ?>
</span>
</div>
<div class="mt-1 text-muted small">
<strong>类型:</strong> <?php echo htmlspecialchars($param['type']); ?>
</div>
<?php if (!empty($param['description'])): ?>
<div class="mt-1 text-sm">
<strong>描述:</strong> <?php echo htmlspecialchars($param['description']); ?>
</div>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="card-footer bg-transparent d-flex justify-content-between">
<small class="text-muted">
<i class="bi bi-box-arrow-up-right"></i>
<a href="<?php echo htmlspecialchars($api['path']); ?>" target="_blank" class="text-decoration-none">访问接口</a>
</small>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<footer class="footer mt-5">
<div class="container">
<div class="row">
<div class="col-md-4 mb-4" id="footer-about">
<h5 class="text-white mb-3">关于我们</h5>
<p class="text-light">专业API接口服务平台提供稳定可靠的接口服务助力开发者快速构建应用。</p>
<div class="text-light">
<div>© <?php echo date('Y'); ?> 快点API</div>
</div>
</div>
<div class="col-md-2 mb-4">
<h5 class="text-white mb-3">快速链接</h5>
<ul class="list-unstyled">
<li class="mb-2"><a href="#" class="text-light text-decoration-none">API文档</a></li>
<li class="mb-2"><a href="#" class="text-light text-decoration-none">使用教程</a></li>
<li class="mb-2"><a href="#" class="text-light text-decoration-none">价格方案</a></li>
<li class="mb-2"><a href="#" class="text-light text-decoration-none">联系我们</a></li>
</ul>
</div>
<div class="col-md-3 mb-4">
<h5 class="text-white mb-3">友情链接</h5>
<ul class="list-unstyled">
<li class="mb-2"><a href="https://quickso.cn" class="text-light text-decoration-none">快点搜</a></li>
</ul>
</div>
<div class="col-md-2 mb-4">
<h5 class="text-white mb-3">联系方式</h5>
<ul class="list-unstyled text-light">
<li class="mb-2"><i class="bi bi-envelope me-2"></i> admin@huangetech.com</li>
</ul>
</div>
</div>
</div>
</footer>
<!-- Bootstrap 5 JS -->
<script src="https://gcore.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script>
// 更新API计数和调用次数
document.addEventListener('DOMContentLoaded', function() {
const apiCount = document.querySelectorAll('.api-card').length;
document.getElementById('api-count').textContent = apiCount;
// 获取并显示实际的日调用次数
fetch('get-counter.php')
.then(response => response.json())
.then(data => {
const callCount = data.count || 0;
const formattedCount = callCount > 1000 ? (callCount / 1000).toFixed(1) + 'K+' : callCount;
document.getElementById('daily-calls').textContent = formattedCount;
})
.catch(error => console.error('Error fetching counter:', error));
// 添加搜索功能
const searchInput = document.getElementById('search-api');
const apiCards = document.querySelectorAll('.api-card');
searchInput.addEventListener('input', function() {
const searchTerm = this.value.toLowerCase();
apiCards.forEach(card => {
const apiName = card.querySelector('.card-title').textContent.toLowerCase();
const apiDescription = card.querySelector('.card-text').textContent.toLowerCase();
const apiUrl = card.querySelector('.text-muted small').textContent.toLowerCase();
if (apiName.includes(searchTerm) || apiDescription.includes(searchTerm) || apiUrl.includes(searchTerm)) {
card.closest('.col-md-6').style.display = '';
} else {
card.closest('.col-md-6').style.display = 'none';
}
});
});
});
</script>
</body>
</html>

989
need.php Normal file
View File

@@ -0,0 +1,989 @@
<?php
class need{
public static $info = [];
/*
* 获取域名
*/
public static function getHost()
{
return (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : false);
}
/*
* emoji转换为UTF-32编码
* @parameter $emoji -> String emoji表情
*/
public static function emoji2utf($emoji) {
$hex = bin2hex(mb_convert_encoding($emoji, 'UTF-32', 'UTF-8'));
return 'u'.substr($hex, 3);
}
/*
* Skey或pskey进行转码
*/
public static function GTK($skey) {
$len = strlen((String)$skey);
$hash = 5381;
for ($i = 0; $i < $len; $i++) {
$hash += ($hash << 5 & 2147483647) + ord($skey[$i]) & 2147483647;
$hash &= 2147483647;
}
return $hash & 2147483647;
}
/*
* json格式化输出
*/
public static function json($arr) {
header('Content-type: application/json; charset=utf-8;');
return json_encode($arr,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
}
/*
* 输出
*/
public static function send($Msg, $Type = 'jsonp') {
header('Content-Type:application/json; charset=utf-8;');
if($Type == 'text') {
echo $Msg;
exit();
}else if($Type == 'location') {
header('location:'.$Msg);
exit();
}else if($Type == 'image') {
header('Content-type:image/png;image/jpeg;image/gif;');
//header('Content-type:image/jpeg');
$curl = New need;
echo $curl->teacher_curl($Msg);
exit();
}else if($Type == 'url') {
echo $Msg;
exit();
}else if($Type == 'tion') {
echo $Msg;
exit();
}else if($Type == 'jsonp') {
echo stripslashes(json_encode($Msg,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
exit();
}else{
echo json_encode($Msg,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
exit();
}
}
/*
* 获取访问者IP
*/
public static function userip() {
$unknown = 'unknown';
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])&&$_SERVER['HTTP_X_FORWARDED_FOR']&&strcasecmp($_SERVER['HTTP_X_FORWARDED_FOR'],$unknown)) {
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
} else if(isset($_SERVER['REMOTE_ADDR'])&&$_SERVER['REMOTE_ADDR']&&strcasecmp($_SERVER['REMOTE_ADDR'],$unknown)) {
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
/*
* qqvip的一种gtk加密但是已经被腾讯弃用了
*/
public static function vipgtk($skey) {
$salt=5381;
$md5key='tencentQQVIP123443safde&!%^%1282';
$hash=array();
$hash[]=$salt<<5;
for ($i=0; $i<strlen($skey); ++$i) {
$acode=ord(substr($skey,$i,1));
$hash[]=($salt<<5)+$acode;
$salt=$acode;
}
$md5str=md5(join('',$hash).$md5key);
return $md5str;
}
/*
* 判断访问者是不是get
*/
public static function get_post() {
if( $_SERVER['REQUEST_METHOD'] === 'GET') {
return true;
}else{
return false;
}
}
/*
* 获取毫秒时间戳
*/
public static function getMillisecond() {
list($t1, $t2) = explode(' ', microtime());
return (float)sprintf('%.0f',(floatval($t1)+floatval($t2))*1000);
}
/*
* 忘了
*/
public static function run_encode($msg) {
$msg = idn_to_ascii($msg,IDNA_NONTRANSITIONAL_TO_ASCII,INTL_IDNA_VARIANT_UTS46);
return $msg;
}
/*
* 忘了
*/
public static function run_decode($msg) {
$msg = idn_to_utf8($msg);
return $msg;
}
/*
* 16进制转码不过没什么用
*/
public static function hex_encode($str) {
$hex="";
for($i=0;$i<strlen($str);$i++)
$hex .= '\\u4E'.dechex(ord($str[$i]));
$hex=$hex;
return $hex;
}
/*
* 16进制解码也没什么用
*/
public static function hex_decode($hex) {
$str="";
for($i=0;$i<strlen($hex)-1;$i+=2)
$str.=chr(hexdec($hex[$i].$hex[$i+1]));
return $str;
}
/*
* unicode 解码
*/
public static function decodeUnicode($str) {
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i',
@create_function(
'$matches',
'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UCS-2BE");'
),
$str);
}
/*
* unicode转码
*/
public static function encodeUnicodes($str) {
$decode = json_decode('{"text":"'.$str.'"}',true);
if(!$decode) {
return $str;
}else{
$encode = json_encode($decode);
preg_match_all('/text":"(.*?)"/',$encode,$encode);
$encode = str_replace('\\u4e','',$encode[1][0]);
$encode = str_replace('\\u4E','',$encode);
return $encode;
}
}
/*
* 转码加密
*/
public static function jiami($string) {
$str = self::hex_encode($string);
$str = self::decodeUnicode($str);
return ($str);
}
/*
* 转码解密
*/
public static function jiemi($string) {
$str = self::encodeUnicodes($string);
$str = self::hex_decode($str);
return $str;
}
/*
* 获取时间戳毫秒
*/
public static function time_sss() {
list($t1, $t2) = explode(' ', microtime());
return (float)sprintf('%.0f',(floatval($t1)+floatval($t2))*1000);
}
/*
* 获取http状态码
*/
public static function http($url) {
$ch = curl_init();
$timeout = 3;
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch,CURLOPT_URL,$url);
curl_exec($ch);
return $httpcode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
curl_close($ch);
}
/*
* 判断是不是qq或者群
*/
public static function is_num($num) {
if(preg_match('/^[1-9][0-9]{4,11}$/', (String)$num)) {
return true;
}else{
return false;
}
}
/*
* Cookie
*/
public static function Robot($dir,$key) {
// $array = @file_get_contents($dir.'Robot_Pskey_Skey.json');
// $array = json_decode($array,true);
// return $array[$key];
return self::cookie($key, true);
}
/*
* Cookie
*/
public static function cookie($key,$Value = false) {
return 'a';
}
/*
* 没用
*/
public static function emoji($text) {
$array = array(
'🐶'=>'狗',
'🐱'=>'猫',
'🐭'=>'鼠',
'🐹'=>'仓鼠',
'🐰'=>'兔',
'🦊'=>'狐狸',
'🐻'=>'熊',
'🐼'=>'熊猫',
'🐨'=>'考拉',
'🐯'=>'虎',
'🦁'=>'狮',
'🐮'=>'牛',
'🐷'=>'猪',
'🐽'=>'猪鼻子',
'🐸'=>'青蛙',
'🐵'=>'猴',
'🐔'=>'鸡',
'🐕'=>'小狗',
'🐂'=>'小牛',
'🐴'=>'马',
'🐎'=>'小马',
'🐖'=>'小猪',
'🦆'=>'鸭',
'🐥'=>'小鸡',
'🐓'=>'公鸡',
'🦅'=>'鹰',
'🦉'=>'猫头鹰',
'🦇'=>'蝙蝠',
'🐺'=>'狼',
'🐗'=>'野猪',
'🦄'=>'独角兽',
'🐝'=>'蜜蜂',
'🐛'=>'虫',
'🦋'=>'蝴蝶',
'🐌'=>'蜗牛',
'🐉'=>'龙',
'🐟'=>'鱼',
'🦐'=>'虾',
'🦞'=>'龙虾',
'🌶️'=>'辣椒',
'🦀'=>'螃蟹',
'🦈'=>'鲨鱼',
'🌿'=>'草',
'🌸'=>'花',
'🍉'=>'瓜',
'💦'=>'汗',
'☀️'=>'太阳',
'🌤'=>'晴转多云',
'⛅'=>'阴',
'🌦️'=>'晴转雨',
'🌧️'=>'小雨',
'⛈️'=>'雷阵雨',
'🌩️'=>'打雷',
'🌧️'=>'大雨',
'❄️'=>'雪花',
'🌨️'=>'雪',
'🌟'=>'闪光星星',
'⚡'=>'电',
'💧'=>'水滴',
'☔'=>'雨伞',
'🌈'=>'彩虹',
'🌊'=>'海浪',
'🌫️'=>'雾',
'🌪️'=>'龙卷风',
'☄️'=>'彗星',
'🪐'=>'有环行星',
'⭐'=>'星',
'✨'=>'闪光',
'👀'=>'看',
'🌝'=>'微笑月亮',
'🌞'=>'微笑太阳',
'🌚'=>'微笑朔月',
'🌙'=>'月亮',
'🌛'=>'微笑上弦月',
'🌜'=>'微笑下弦月',
'🌕'=>'满月',
'🌖'=>'亏凸月',
'🌗'=>'下弦月',
'🌘'=>'残月',
'🌔'=>'盈凸月',
'🌓'=>'上弦月',
'🌒'=>'娥眉月',
'🌑'=>'朔月',
'🚗'=>'汽车',
'🚌'=>'公交车',
'🚞'=>'火车',
'🚚'=>'货车',
'✈️'=>'飞机',
'🚕'=>'出租车',
'🍜'=>'面',
'🐦'=>'鸟',
'🚓'=>'警车',
'🚢'=>'船',
'☃️'=>'雪人',
'㊗️'=>'祝',
'🈷️'=>'月',
'👍🏻'=>'赞',
'🍺'=>'啤酒',
'🎁'=>'礼物',
'🎆'=>'烟花',
'🎉'=>'恭喜',
'🎄'=>'圣诞',
'🍎'=>'苹果',
'🍐'=>'梨',
'🍌'=>'香蕉',
'🍇'=>'葡萄',
'🍓'=>'草莓',
'🍅'=>'西红柿',
'🍊'=>'橘子',
'🥚'=>'蛋',
'🍚'=>'米饭',
'🦴'=>'骨',
'🥁'=>'鼓',
'📖'=>'书',
'🌲'=>'树',
'🍋'=>'柠檬',
'🍟'=>'薯条',
'🍔'=>'汉堡',
'🍠'=>'地瓜',
'🥩'=>'肉',
'🌹'=>'玫瑰',
'❤️'=>'心',
'🍳'=>'煎蛋',
'✂️'=>'剪刀',
'🍙'=>'饭团',
'🦍'=>'猩猩',
'❤'=>'心',
'💩'=>'💩',
'☂️'=>'伞',
'💰'=>'钱',
'💵'=>'美元',
'👄'=>'嘴',
'💄'=>'口红',
'🍼'=>'奶瓶',
'👍🏻'=>'赞',
'🦟'=>'蚊子',
'👻'=>'鬼',
'🐢'=>'乌龟',
'🐧'=>'企鹅',
'🐍'=>'蛇',
'🈲'=>'禁',
'🔞'=>'十八禁',
'🐁'=>'小白鼠',
'✍🏻'=>'写',
'👟'=>'鞋',
'⭕'=>'圈',
'🛠️'=>'工具',
'🛣️'=>'公路',
'🚥'=>'路灯',
'🌀'=>'飓风',
'👑'=>'皇冠',
'🥒'=>'黄瓜',
'🌼'=>'花',
'💊'=>'药',
'👨🏻'=>'男',
'👩🏻'=>'女',
'👴🏻'=>'爷',
'👵🏻'=>'奶',
'✌🏻'=>'耶',
'🉐'=>'得',
'㊙️'=>'秘',
'👅'=>'舔',
'🉑'=>'可',
'🈚'=>'无',
'💃🏻'=>'舞',
'😭'=>'哭',
'🙂'=>'微笑',
'🧵'=>'线',
'🤪'=>'滑稽',
'😆'=>'笑',
'😓'=>'汗',
'👌🏻'=>'好',
'🕰️'=>'钟',
'🀄'=>'中',
'🚿'=>'洗',
'🈶'=>'有',
'🆙'=>'升',
'🍑'=>'桃',
'🍵'=>'茶',
'🍬'=>'糖',
'🍭'=>'糖',
'🈯'=>'指',
'🌰'=>'栗子',
'😁'=>'嘻',
'😃'=>'哈',
'🈳'=>'空',
'😍'=>'色',
'🥵'=>'热',
'🥶'=>'冷',
'🕳️'=>'洞',
'👿'=>'恶魔',
'👏🏻'=>'鼓掌',
'🤮'=>'吐',
'😏'=>'坏笑'
);
foreach($array as $k=>$v) {
$text = str_replace($k,$v,$text);
}
return $text;
}
/*
* curl
*/
public static function teacher_curl($url, $paras = array()) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
if (@$paras['Header']) {
$Header = $paras['Header'];
} else {
$Header[] = "Accept:*/*";
$Header[] = "Accept-Encoding:gzip,deflate,sdch";
$Header[] = "Accept-Language:zh-CN,zh;q=0.8";
$Header[] = "Connection:close";
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $Header);
if (@$paras['ctime']) { // 连接超时
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $paras['ctime']);
} else {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
}
if (@$paras['rtime']) { // 读取超时
curl_setopt($ch, CURLOPT_TIMEOUT, $paras['rtime']);
}
if (@$paras['post']) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $paras['post']);
}else{
curl_setopt($ch, CURLOPT_HTTPGET, 1);
}
if (@$paras['header']) {
curl_setopt($ch, CURLOPT_HEADER, true);
}
if (@$paras['cookie']) {
if(@$paras['Cookie']) {
foreach(explode('; ', $paras['cookie']) as $v)
{
curl_setopt($ch, CURLOPT_COOKIE, $v);
}
} else {
curl_setopt($ch, CURLOPT_COOKIE, $paras['cookie']);
}
}
if (@$paras['refer']) {
if ($paras['refer'] == 1) {
curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f=');
} else {
curl_setopt($ch, CURLOPT_REFERER, $paras['refer']);
}
}
if (@$paras['ua']) {
curl_setopt($ch, CURLOPT_USERAGENT, $paras['ua']);
} else {
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36");
}
if (@$paras['nobody']) {
curl_setopt($ch, CURLOPT_NOBODY, 1);
}
if(@$paras['resolve']) {
curl_setopt($ch, CURLOPT_IPRESOLVE, 1);
}
if(@$paras['jump']) {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
}
curl_setopt($ch, CURLOPT_ENCODING, "gzip");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
/*
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); //代理认证模式
curl_setopt($ch, CURLOPT_PROXY, "114.114.114.114"); //代理服务器地址
//curl_setopt($ch, CURLOPT_PROXYPORT, 12635); //代理服务器端口
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
*/
if (@$paras['GetCookie']) {
curl_setopt($ch, CURLOPT_HEADER, 1);
$result = curl_exec($ch);
preg_match_all("/Set-Cookie: (.*?);/m", $result, $matches);
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($result, 0, $headerSize); //状态码
$body = substr($result, $headerSize);
$ret = [
"Cookie" => $matches, "body" => $body, "header" => $header, 'code' => curl_getinfo($ch, CURLINFO_HTTP_CODE)
];
curl_close($ch);
return $ret;
}
$ret = curl_exec($ch);
if(curl_errno($ch))
{
curl_close($ch);
return false;
}
if (@$paras['loadurl']) {
$Headers = curl_getinfo($ch);
$ret = $Headers['redirect_url'];
}
self::$info = curl_getinfo($ch);
curl_close($ch);
return $ret;
}
/*
* 随机获取一个IP
*/
public static function Rand_IP() {
#第一种方法,直接生成
$ip2id= round(rand(600000, 2550000) / 10000);
$ip3id= round(rand(600000, 2550000) / 10000);
$ip4id= round(rand(600000, 2550000) / 10000);
#第二种方法,随机抽取
$arr_1 = array("218","218","66","66","218","218","60","60","202","204","66","66","66","59","61","60","222","221","66","59","60","60","66","218","218","62","63","64","66","66","122","211");
$randarr= mt_rand(0,count($arr_1)-1);
$ip1id = $arr_1[$randarr];
return $ip1id.".".$ip2id.".".$ip3id.".".$ip4id;
}
/*
* get访问获取数据
*/
public static function getResponseBody($url) {
$ch = curl_init();
#5秒超时
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5000);
#设置默认ua 这里经常测试尽量用手机的ua,电脑的ua获取不到数据
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36');//'User-Agent: Mozilla/5.0 (Linux; Android 5.1.1; vivo X9 Plus Build/LMY48Z) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36');
#把随机ip添加进请求头
$httpheader = [];
$httpheader[] = 'X-FORWARDED-FOR:'.self::Rand_IP();
$httpheader[] = 'CLIENT-IP:'.self::Rand_IP();
#请求头中添加cookie
$httpheader[] = 'cookie:did=web_'.md5(time() . mt_rand(1,1000000)).'; didv='.time().'000;';
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
#返回数据不直接输出
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
#设置请求地址
curl_setopt($ch, CURLOPT_URL, $url);
#关闭ssl验证
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
#设置默认referer
curl_setopt($ch, CURLOPT_REFERER, 'https://www.moestack.com');
#get方式请求
curl_setopt($ch, CURLOPT_POST, false);
$contents = curl_exec($ch);
curl_close($ch);
return $contents;
}
/*
* get访问获取头部
*/
public static function getResponseHeader($url) {
$ch = curl_init($url);
$httpheader = [];
$httpheader[] = 'X-FORWARDED-FOR:'.self::Rand_IP();
$httpheader[] = 'CLIENT-IP:'.self::Rand_IP();
#请求头中添加cookie
$httpheader[] = 'cookie:did=web_'.md5(time() . mt_rand(1,1000000)).'; didv='.time().'000;clientid=3; client_key=6589'.rand(1000, 9999);
curl_setopt($ch, CURLOPT_HTTPHEADER,$httpheader);
#以下两句设置返回响应头不返回响应体
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
#返回数据不直接输出
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
/*
* 获取get post请求可以get+号
*/
public static function request() {
$explode = explode('&', $_SERVER['QUERY_STRING']);
// print_r($explode);
$Request = [];
foreach($explode as $value) {
$explod = explode('=', $value, 2);
$Request[@$explod[0]] = @$explod[1] ?: null;
//print_r($explod);
unset($explod);
}
foreach($Request as $k=>$v) {
if(!empty($v)) {
$fileType = mb_detect_encoding($v, array('UTF-8','GBK','LATIN1','BIG5','GB2312')) ;
if($fileType != 'UTF-8') {
$data = mb_convert_encoding($v, 'utf-8', $fileType);
}else{
$data = $v;
}
}else{
$data = $v;
}
$array[$k] = urldecode((String) $data);
unset($data, $fileType);
}
// print_r($array);
return array_merge($array, $_POST);
}
/*
* 读取文件夹内某些文件的绝对路径
*/
public static function read_all($dir, ...$type) {
if (!is_dir($dir)) {
return array();
}
$dir = preg_replace('/\/$/', '', $dir);
$textarray = [];
$handle = opendir($dir);
if ($handle) {
while (($fl = readdir($handle)) !== false) {
$temp = iconv('utf-8', 'utf-8', $dir . DIRECTORY_SEPARATOR . $fl);
//转换成utf-8格式
//如果不加 $fl!='.' && $fl != '..' 则会造成把$dir的父级目录也读取出来
if (!(is_dir($temp) && $fl != '.' && $fl != '..')) {
if ($fl != '.' && $fl != '..') {
$suffix = substr(strrchr($fl, '.'), 1);
if($type)
{
foreach($type as $v) {
if ($suffix == $v) {
$textarray[] = array("path" => $dir . DIRECTORY_SEPARATOR, "name" => $fl, 'file'=>$dir.DIRECTORY_SEPARATOR.$fl, 'suffix'=>$suffix);
}
}
} else {
$textarray[] = array("path" => $dir . DIRECTORY_SEPARATOR, "name" => $fl, 'file'=>$dir.DIRECTORY_SEPARATOR.$fl, 'suffix'=>$suffix);
}
}
}
}
}
return $textarray;
}
/*
* 读取某些文件夹的所有子文件夹
*/
public static function read_all_dir($dir) {
if(!is_dir($dir)) {
return false;
}
$dir = preg_replace('/\/$/', '', $dir);
$array = scandir($dir);
// print_r($array);
foreach($array as $k=>$v) {
$temp = iconv('utf-8', 'utf-8', $dir . DIRECTORY_SEPARATOR . $v);
if(is_dir($temp) && $v != '.' && $v != '..') {
$dirarray[] = ['name'=>$v, 'path'=>$temp];
}
}
return $dirarray;
}
/*
* 获取跳转
*/
public static function loadurl($url, $Array = []) {
if(!isset($Array['loadurl']) || $Array['loadurl'] != 1) {
$Array['loadurl'] = 1;
}
$Array['nobody'] = 1;
$urls = self::teacher_curl($url, $Array);
if(stristr($urls, '//')) {
return self::loadurl($urls);
}
return $url;
}
/*
* ASCII转utf8
*/
public static function ASCII_UTF8($string) {
preg_match_all('/&#([0-9]+);/', $string, $int);
if(empty($int[1])) {
return $string;
}
foreach($int[1] as $k=>$v) {
$string = str_replace('&#'.$v.';', chr($v), $string);
}
return $string;
}
/*
* 一种加密
*/
public static function encrypt($string, $operation, $key='ovooa') {
$key=md5($key);
$key_length=strlen($key);
$string = $operation == 'D' ? str_replace(' ', '+', $string) : $string;
$string=$operation=='D'?base64_decode($string):substr(md5($string.$key),0,8).$string;
$string_length=strlen($string);
$rndkey=$box=array();
$result='';
for($i=0;$i<=255;$i++) {
$rndkey[$i]=ord($key[$i%$key_length]);
$box[$i]=$i;
}
for($j=$i=0;$i<256;$i++) {
$j=($j+$box[$i]+$rndkey[$i])%256;
$tmp=$box[$i];
$box[$i]=$box[$j];
$box[$j]=$tmp;
}
for($a=$j=$i=0;$i<$string_length;$i++) {
$a=($a+1)%256;
$j=($j+$box[$a])%256;
$tmp=$box[$a];
$box[$a]=$box[$j];
$box[$j]=$tmp;
$result.=chr(ord($string[$i])^($box[($box[$a]+$box[$j])%256]));
}
if($operation=='D') {
if(substr($result,0,8)==substr(md5(substr($result,8).$key),0,8)) {
return substr($result,8);
}else{
return 'key错误';
}
}else{
return str_replace('=','',base64_encode($result));
}
}
/*
* 去除空占位符
*/
public static function nate($String) {
return str_replace(Array("\r", "\n", "\r\n", ' '), '', (String) $String);
}
public static function is_Skey($Skey) {
if(strlen(str_replace(' ', '', $Skey)) == 10) {
return true;
}else{
return false;
}
}
/*
* 判断是否是pskey
*/
public static function is_Pskey($Pskey) {
if(strlen((String) $Pskey) == 44) {
//preg_match('/^.{38,46}$/', $Pskey)
return true;
}else{
return false;
}
}
/*
* 判断是否是手机号
*/
public static function is_phone($number) {
if(preg_match('/^1[1-9][0-9]{9,10}$/', $number))
{
return true;
}else{
return false;
}
}
/*
* 忘了
*/
public static function strtouni($str)
{
return preg_replace('/^"|"$/', '', Json_encode((string)$str));
}
/*
* 忘了
*/
public static function unitostr($uni)
{
return preg_replace_callback("#\\\u([0-9a-f]{4})#i", function ($r) {
return iconv('UCS-2BE', 'UTF-8', pack('H4', $r[1]));
},
$uni);
}
/*
* mb库的split
*/
public static function mb_split($string, $split_length = 1, $encoding = null)
{
if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
trigger_error('mb_str_split(): expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);
return null;
}
if (null !== $split_length && !\is_bool($split_length) && !\is_numeric($split_length)) {
trigger_error('mb_str_split(): expects parameter 2 to be int, '.\gettype($split_length).' given', E_USER_WARNING);
return null;
}
$split_length = (int) $split_length;
if (1 > $split_length) {
trigger_error('mb_str_split(): The length of each segment must be greater than zero', E_USER_WARNING);
return false;
}
if (null === $encoding) {
$encoding = mb_internal_encoding();
} else {
$encoding = (string) $encoding;
}
if (! in_array($encoding, mb_list_encodings(), true)) {
static $aliases;
if ($aliases === null) {
$aliases = [];
foreach (mb_list_encodings() as $encoding) {
$encoding_aliases = mb_encoding_aliases($encoding);
if ($encoding_aliases) {
foreach ($encoding_aliases as $alias) {
$aliases[] = $alias;
}
}
}
}
if (! in_array($encoding, $aliases, true)) {
trigger_error('mb_str_split(): Unknown encoding "'.$encoding.'"', E_USER_WARNING);
return null;
}
}
$result = [];
$length = mb_strlen($string, $encoding);
for ($i = 0; $i < $length; $i += $split_length) {
$result[] = mb_substr($string, $i, $split_length, $encoding);
}
return $result;
}
/*
* 删除过期文件
*/
public static function delfile($dir, $time)
{
if(is_dir($dir)) {
if($dh=opendir($dir)) {
while (false !== ($file = readdir($dh))) {
// $count = strstr($file,'duodu-')||strstr($file,'dduo-')||strstr($file,'duod-');
if($file!='.' && $file!='..') {
$fullpath=$dir.'/'.$file;
if(!is_dir($fullpath)) {
$filedate=filemtime($fullpath);
$minutes=round((time()-$filedate)/60);
if($minutes>$time) unlink($fullpath);
//删除文件
}
}
}
}
}
closedir($dh);
return true;
}
/*
* 阿拉伯数字转大写数字有bug
*/
public static function chinanum($num)
{
$char = array("","","","","","","","","","");
$dw = array("","","","","","亿","");
$retval = "";
$proZero = false;
for($i = 0;$i < strlen($num);$i++) {
if($i > 0)
{
$temp = (int)(($num % pow (10,$i+1)) / pow (10,$i));
}
else {
$temp = (int)($num % pow (10,1));
}
if($proZero == true && $temp == 0)
{
continue;
}
if($temp == 0)
{
$proZero = true;
} else {
$proZero = false;
}
if($proZero)
{
if($retval == "")
{
continue;
}
$retval = $char[$temp].$retval;
} else {
$retval = $char[$temp].$dw[$i].$retval;
}
}
if($retval == "一十")
{
$retval = "";
}
$retval = str_replace('一十','十',$retval);
return $retval;
}
/*
* 判断是否是邮箱
*/
public static function is_email($email)
{
$pattern_test = "/([a-z0-9]*[-_.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z]{2})?/i";
return preg_match($pattern_test, $email);
}
/*
* 忘了
*/
public static function getRandomHex($length)
{
if (function_exists('random_bytes')) {
return bin2hex(random_bytes($length / 2));
}
if (function_exists('mcrypt_create_iv')) {
return bin2hex(mcrypt_create_iv($length / 2, MCRYPT_DEV_URANDOM));
}
if (function_exists('openssl_random_pseudo_bytes')) {
return bin2hex(openssl_random_pseudo_bytes($length / 2));
}
}
/*
* 转码,忘了转什么
*/
public static function bchexdec($hex)
{
$dec = 0;
$len = strlen($hex);
for ($i = 1; $i <= $len; $i++) {
$dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i))));
}
return $dec;
}
/*
* 同上
*/
public static function bcdechex($dec)
{
$hex = '';
do {
$last = bcmod($dec, 16);
$hex = dechex($last).$hex;
$dec = bcdiv(bcsub($dec, $last), 16);
} while ($dec > 0);
return $hex;
}
/*
* str转16进制
*/
public static function str2hex($string)
{
$hex = '';
for ($i = 0; $i < strlen($string); $i++) {
$ord = ord($string[$i]);
$hexCode = dechex($ord);
$hex .= substr('0'.$hexCode, -2);
}
return $hex;
}
}

16
web.config Normal file
View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
</files>
</defaultDocument>
</system.webServer>
</configuration>