You are not logged in.

1

Thursday, May 19th 2005, 10:02pm

Titel einer .html heruasfinden?

Kurz und schmerzlos - wie kann man den Titel einer HTML-Datei rausfinden?

mein bisheriger Code:

PHP Source code

1
2
3
4
           $q file_get_contents($datei);
            $ll explode("<title>",$q);
            $ll2 explode("</title>",$ll);
            $titel $ll2[0];

Ausgabe ist nur Array
Was is daran verbesserungswürdig?

Mattze

Master

Posts: 1,316

Location: Stuttgart

Occupation: Student

  • Send private message

2

Thursday, May 19th 2005, 10:16pm

Nicht getestet:

PHP Source code

1
2
3
4
$q file_get_contents($datei);
            $ll explode("<title>",$q);
            $ll2 explode("</title>",$ll[1]);
            $titel $ll2[0]; 

3

Friday, May 20th 2005, 8:04am

Danke, hat geklappt!
Bin heut schon bisschen durcheinander :D

4

Friday, May 20th 2005, 3:00pm

Hallo,
getestet:

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
12
<?php
$fp fopen($datei,"r");
    while (!feof($fp)) {
      $linie fgets($fp1024);
      if(eregi("<title>(.*)</title>"$linie$title))
      break;
    }
$title $title[1];
echo $title;
fclose($fp);

?>