$url = filter(ge[文]t('ur[章]l'));[来]
if (!$url) {
return json([[自]9;code[就]9; => -1, 'msg&[爱]#39; => '链接不能[技]为空!'][术]);
} else if (get_curl[网]($url) === false) {
return json([[文]9;code[章]9; => -1, 'msg&[来]#39; => '提交的网[自]址无法访问![就]9;]);
}
$data = get_curl([爱]$url);
//Title
preg_matc[技]h('/&[术]lt;TITLE&[网]gt;([\w\W[文]]*?)<\[章]/TITLE>[来];/si'[自], $data, $Title);
if (!empty($[就]Title[1])[爱]) {
$title = $Title[1][技];
}
//Keyword[术]s
preg_matc[网]h('/&[文]lt;META\s[章]+name=&qu[来]ot;keywor[自]ds"\[就]s+content[爱]="([[技]\w\W]*?)&[术]quot;/si&[网]#39;, $data, $Keywords[文]);
if (empty($K[章]eywords[1[来]])) {
preg_matc[自]h("/[就]<META\[爱]s+name=[技]39;keywor[术]ds'\s[网]+content=[文]'([\w[章]\W]*?)[来]9;/si&quo[自]t;, $data, $Keywords[就]);
}
if (empty($K[爱]eywords[1[技]])) {
preg_matc[术]h('/&[网]lt;META\s[文]+content=[章]"([\[来]w\W]*?)&q[自]uot;\s+na[就]me="[爱]keywords&[技]quot;/si&[术]#39;, $data, $Keywords[网]);
}
if (empty($K[文]eywords[1[章]])) {
preg_matc[来]h('/&[自]lt;META\s[就]+http-equ[爱]iv="[技]keywords&[术]quot;\s+c[网]ontent=&q[文]uot;([\w\[章]W]*?)&quo[来]t;/si'[自];, $data, $Keywords[就]);
}
if (!empty($[爱]Keywords[[技]1])) {
$keywords[术] = $Keywords[网][1];
}
//Description
preg_matc[文]h('/&[章]lt;META\s[来]+name=&qu[自]ot;descri[就]ption&quo[爱]t;\s+cont[技]ent="[术];([\w\W]*[网]?)"/[文]si', $data, $Descript[章]ion);
if (empty($D[来]escriptio[自]n[1])) {
preg_matc[就]h("/[爱]<META\[技]s+name=[术]39;descri[网]ption'[文];\s+conte[章]nt='([来][\w\W]*?)[自]'/si&[就]quot;, $data, $Descript[爱]ion);
}
if (empty($D[技]escriptio[术]n[1])) {
preg_matc[网]h('/&[文]lt;META\s[章]+content=[来]"([\[自]w\W]*?)&q[就]uot;\s+na[爱]me="[技]descripti[术]on"/[网]si', $data, $Descript[文]ion);
}
if (empty($D[章]escriptio[来]n[1])) {
preg_matc[自]h('/&[就]lt;META\s[爱]+http-equ[技]iv="[术]descripti[网]on"\[文]s+content[章]="([[来]\w\W]*?)&[自]quot;/si&[就]#39;, $data, $Descript[爱]ion);
}
if (!empty($[技]Descripti[术]on[1])) {
$descript[网]ion = $Descript[文]ion[1];
}
if ($Title[1[章]] !== "&qu[来]ot;) {
dataLog(&[自]#39;URL[&[就]#39;.$url[爱].发布单页信息获取[技]成功!',[术]'1[网]9;,'1[文]');
$result = array([章]9;code[来]9;=>0,[自]'msg&[就]#39;=>[爱]'获取成功[技]!',[术]39;title&[网]#39;=>[文]$title,[章]39;keywor[来]ds'=&[自]gt;$keywo[就]rds,'[爱]descripti[技]on'=&[术]gt;$descr[网]iption);
} else {
$result = array([文]9;code[章]9;=>-1[来],'msg[自]'=>[就];'站点信[爱]息获取失败![技]9;);
}
if (json_enc[术]ode($resu[网]lt) === false) {
return json([[文]9;code[章]9; => -1, 'msg&[来]#39; => '站点信息[自]获取失败!'[就];]);
} else {
return json($res[爱]ult);
}
本文暂无评论 - 欢迎您