请问php如何提取出网页目录下文件的所有
发布网友
发布时间:2022-05-13 04:16
我来回答
共1个回答
热心网友
时间:2023-11-18 00:44
<?php
if($_REQUEST["method"]=="do")
{
$url = $_POST["url"];
$lines_array = file($url);
$lines_string = implode('',$lines_array);
eregi("<title>.*</title>",$lines_string,$title);
$tit = $title[0];
$tit = substr(trim($tit),7,(strlen($tit)-15));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>获取某网页的标题</title>
</head>
<body style="font-size:12px">
<form action="a.php?method=do" name="frm1" method="post">
<input name="url" type="text" value="http://" size="35" />
<input name="确定" type="submit" id="确定" value="提交" />
<?=$tit?>
</form>
</body>
</html>