多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
~~~ <?php error_reporting(0); $url = $_GET['url']; $html = getHtml($url); preg_match('/<title.*?>(.*?)<\/title>/is', $html, $matched); $title = $matched[1]; $title = str_replace("首页", "", $title); $title = str_replace("网站-", "", $title); $title = str_replace("—", "", $title); $title = str_replace("-", "", $title); $title = str_replace("欢迎来到", "", $title); $title = str_replace("!", "", $title); echo json_encode(['code' => 200, 'title' => $title]); function getHtml($url) { $header = []; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $result = curl_exec($ch); curl_close($ch); $result = mb_convert_encoding($result, 'UTF-8', 'UTF-8,GBK,GB2312,BIG5'); return $result; } ~~~