🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: de.comp.lang.php
Article #28

Re: HTML File

#28
From: Martin Jansen
Date: Thu, 13 Jul 2000 00:00
26 lines
1418 bytes
* "Jose Luis" <joseluis@REMOVEMEferca.com> wrote:
>I need some function that tell me if a file that my visitors put in a form
>is an HTML file or not.

The only idea, I have, might be to check for the "typical" tags, that
occur in a html-file:

This might look like this:

<?php

/* $buffer contains the whole content of the html-file */

if (eregi("<html>",$buffer) AND eregi("<head>",$buffer) AND
ereg("<body>",$buffer))
  echo "The file seems to be an html-file.";
?>

Of course you can add more Regular Expressions to the script to look
for other html-specific tags.

HTH,
Martin
-- 
Martin Jansen  � mailto:mail@martin-jansen.de
PGP 0x18176561 � http://www.php.martin-jansen.de/
Technical Details
Message-ID: <3c9smscj8c7mo3cfnmgm40t1ca08aqro92@4ax.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8kjovp$fb1$1@talia.mad.ttd.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10f92b,d1e182c066e0b422
X-Google-Attributes: gid10f92b,public
X-Google-Thread: 10ce1c,d1e182c066e0b422
X-Google-Attributes: gid10ce1c,public
From: Martin Jansen <mail@martin-jansen.de>
Subject: Re: HTML File
Date: 2000/07/13
Message-ID: <3c9smscj8c7mo3cfnmgm40t1ca08aqro92@4ax.com>
X-Deja-AN: 646056851
Content-Transfer-Encoding: 8bit
References: <8kjovp$fb1$1@talia.mad.ttd.net>
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: fu-berlin.de 963521299 2904591 212.202.72.92 (16 1667 [8988])
Organization: Chaos, Unordnung & Co GmbH
Mime-Version: 1.0
Reply-To: derjansen@gmx.de (Martin Jansen)
Newsgroups: de.comp.lang.php,ba.php