(.*)<\/title>/", $str, $matches); return $matches[1]; } function getimg (string $str): string { preg_match('//', $str, $matches); return $matches[1]; } function getdesc (string $str): string { $res = preg_replace('/
(.*?)<\/div>/s', "", $str); return strip_tags($res); } /* 記事かの確認 */ function isarticle (string $url): bool { $chk = explode("=", $url); if (isset($chk[0]) && $chk[0] == "view_news.pl?id" && isset($chk[1]) && isset($chk[2])) { $chk2 = explode("&", $chk[1]); if (isset($chk2[1]) && $chk2[1] == "media_id") return true; } return false; } /* 記事だけが残るまで消す */ function rmbloat (string $body): string { $res = preg_replace('/(.*?)
/s', "", $body); $res = preg_replace('/(.*?)<\/html>/s', "", $res); $res = preg_replace('/

(.*?)<\/p>/s', "", $res); $res = preg_replace('/