리자

태그 갯수를 알아보는 페이지

파일명 : tablecheck.php


<?
@extract($_GET);

if (!$url) {
echo "?url= 값을 넘겨주세요.";
exit;
}

$s = implode(" ", file($url, "r"));
$s = strtolower($s);
$table1 = substr_count($s, "<table");
$table2 = substr_count($s, "</table");
$tr1 = substr_count($s, "<tr");
$tr2 = substr_count($s, "</tr");
$td1 = substr_count($s, "<td");
$td2 = substr_count($s, "</td");
$form1 = substr_count($s, "<form");
$form2 = substr_count($s, "</form");
$a1 = substr_count($s, "<a ");
$a2 = substr_count($s, "</a");

echo "<br>&lt;table&gt; &nbsp;: ".$table1;
echo "<br>&lt;/table&gt; : ".$table2;
echo "<br>&lt;tr&gt; &nbsp;: ".$tr1;
echo "<br>&lt;/tr&gt; : ".$tr2;
echo "<br>&lt;td&gt; &nbsp;: ".$td1;
echo "<br>&lt;/td&gt; : ".$td2;
echo "<br>&lt;form&gt; &nbsp;: ".$form1;
echo "<br>&lt;/form&gt; : ".$form2;
echo "<br>&lt;a&gt; &nbsp;: ".$a1;
echo "<br>&lt;/a&gt; : ".$a2;
?>



사용법 : http://도메인/tablecheck.php?url=http://주소

결과 :

<table> : 33
</table> : 33
<tr> : 70
</tr> : 69
<td> : 98
</td> : 97
<form> : 2
</form> : 2
<a> : 20
</a> : 20

* 테이블과 관련된 태그 갯수를 알아보고자 하는 경우 유용합니다.
|

댓글 3개

좋은 팁 감사합니다.....
멋진 팁이군요. 감사합니다 ^^

덤으로 화면에서 링크 받아서 확인해볼수있는 링크가 그누보드에도 하나 있으면 좋겠군요. ^^
감사합니다.
div, span까지 끼워넣어서 해보란 말씀이시죠?!
엇~!! 짝이 안맞는 녀석도 보이네요.^^

ps)서버에서 파일함수를 막아놓은 것인가요??
Warning: file(): URL file-access is disabled in the server configuration in ~~tablecheck.php on line 9

ps2)돌아가는 방법을 찾았습니다.^^

ps3)소켓으로.. http://www.sir.co.kr/bbs/tb.php/g4_tiptech/7452

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기
🐛 버그신고