删除 More/t.php.bak

This commit is contained in:
2025-10-17 23:32:12 +08:00
committed by cssfw
parent 917d269c83
commit 1f5ac5e0ca
79 changed files with 13493 additions and 0 deletions

49
Dashboard/b.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
header('Content-Type: application/json');
function fetchBingResults($query) {
$url = "https://www.bing.com/search?q=" . urlencode($query) . "&count=10";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36');
$html = curl_exec($ch);
curl_close($ch);
if (!$html) return [];
$dom = new DOMDocument();
@$dom->loadHTML($html);
$results = [];
$blocks = $dom->getElementsByTagName('div')->item(0)->getElementsByTagName('div');
foreach ($blocks as $block) {
$title = $block->getElementsByTagName('h2')->item(0)->textContent;
$link = $block->getElementsByTagName('a')->item(0)->getAttribute('href');
$description = $block->getElementsByTagName('p')->item(0)->textContent;
$results[] = [
'title' => trim($title),
'link' => trim($link),
'description' => trim($description),
'icon' => null // 网页版Bing不显示图标
];
}
return $results;
}
$searchTerm = isset($_GET['p']) ? $_GET['p'] : 'Kentucky';
$results = fetchBingResults($searchTerm);
$response = [
'results' => $results,
'total' => count($results),
'max_page' => 1
];
echo json_encode($response);
?>