File: /www/wwwroot/ly.kntsleep.com/pp.php
<?php
// 目标 URL
ini_set('user_agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3');
$url = 'https://jup.ag/zh-SG/perps-earn';
// 获取页面内容
$html = file_get_contents($url);
stream_context_set_default(
array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
),
)
);
// 等待 10 秒
sleep(10);
// 创建 DOM 解析器
$dom = new DomDocument();
@$dom->loadHTML($html); // 加上@符号用于忽略可能产生的警告信息
// 根据 class 名称提取内容
$classname = 'text-3xl';
$finder = new DomXPath($dom);
$nodes = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' $classname ')]");
// 输出提取的内容
foreach ($nodes as $node) {
echo $node->nodeValue;
}
?>