One Hat Cyber Team
Your IP :
18.227.183.215
Server IP :
50.28.103.30
Server :
Linux host.jcukjv-lwsites.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
Server Software :
nginx/1.24.0
PHP Version :
8.3.12
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
ef.electronharmony.com
/
2
/
Edit File:
get_preview.php
<?php if (isset($_GET['url'])) { $url = $_GET['url']; // 验证 URL 格式 if (!filter_var($url, FILTER_VALIDATE_URL)) { echo json_encode(['success' => false, 'message' => 'Invalid URL']); exit; } // 使用 cURL 获取页面内容 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $html = curl_exec($ch); curl_close($ch); if (!$html) { echo json_encode(['success' => false, 'message' => 'Failed to fetch URL content']); exit; } // 解析 HTML 内容 $dom = new DOMDocument(); @$dom->loadHTML($html); $title = 'No Title Available'; $keywords = 'No Keywords Available'; $description = 'No Description Available'; $logo = 'images/lazy.svg'; $country = 'Unknown'; // 提取标题 $titleNodes = $dom->getElementsByTagName('title'); if ($titleNodes->length > 0) { $title = $titleNodes->item(0)->textContent; } // 提取 Meta 标签 foreach ($dom->getElementsByTagName('meta') as $meta) { $name = strtolower($meta->getAttribute('name')); if ($name === 'keywords') { $keywords = $meta->getAttribute('content') ?: $keywords; } if ($name === 'description') { $description = $meta->getAttribute('content') ?: $description; } } // 提取 Logo foreach ($dom->getElementsByTagName('link') as $link) { if ($link->getAttribute('rel') === 'icon') { $logo = $link->getAttribute('href'); // 处理相对路径 if (!filter_var($logo, FILTER_VALIDATE_URL)) { $parsedUrl = parse_url($url); $logo = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/' . ltrim($logo, '/'); } break; } } // 下载并保存 Logo if ($logo !== 'images/lazy.svg') { $uploadsDir = __DIR__ . '/style/uploads/'; if (!is_dir($uploadsDir)) { mkdir($uploadsDir, 0755, true); // 如果文件夹不存在,则创建 } $fileName = uniqid() . '_' . basename(parse_url($logo, PHP_URL_PATH)); // 防止文件名冲突 $filePath = $uploadsDir . $fileName; $ch = curl_init($logo); $fp = fopen($filePath, 'wb'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_exec($ch); curl_close($ch); fclose($fp); // 更新 logo 路径为本地路径 $logo = 'style/uploads/' . $fileName; } // 获取国家信息 $host = parse_url($url, PHP_URL_HOST); $ip = gethostbyname($host); if ($ip !== $host) { // 如果成功解析 IP 地址 $geoApiUrl = "http://ip-api.com/json/{$ip}"; $geoResponse = @file_get_contents($geoApiUrl); if ($geoResponse) { $geoData = json_decode($geoResponse, true); if ($geoData && $geoData['status'] === 'success') { $country = $geoData['country']; } } } // 返回 JSON 响应 echo json_encode([ 'success' => true, 'logo' => $logo, 'title' => $title, 'keywords' => $keywords, 'description' => $description, 'country' => $country, ]); exit; } echo json_encode(['success' => false, 'message' => 'No URL provided']);
Simpan