其他教程

其他教程

Products

当前位置:首页 > 其他教程 >

PHP获取网站TDK标题API接口源码

GG网络技术分享 2025-03-18 16:18 0


php获取网站TDK标题API接口源码,目前只能获取标题

接口源码:

<?php

if ($_GET[\'url\']) {

$site=\'https://\';

$url=trim($site.$_GET[\'url\']);

$info=file_get_contents($url);

header(\'Content-type:text/json\');

preg_match(\'|<title>(.*?)</title>|i\',$info,$m);

if($url){

$result=array(\"code\"=>\"200\",\"title\"=>$m[1]);

echo json_encode($result,JSON_UNESCAPED_UNICODE);

}else{

$result=array(\"code\"=>\"201\",\"meg\"=>\"ERREO\");

echo json_encode($result,JSON_UNESCAPED_UNICODE);

}

}else{

$result=array(\"code\"=>\"201\",\"meg\"=>\"ERREO\");

echo json_encode($result,JSON_UNESCAPED_UNICODE);

}

?>

标签: 源码 接口

提交需求或反馈

Demand feedback