Extract title from a file in php

Viewed 23

I have a php code in which I want to extract a title from a file in php.

$good_title = ExtractGoodTitle("good/web/gooddump/GOOD_2.html");  // Line A


function ExtractGoodTitle($filename)
{

.
.
.
.
    return $title;
}

The function ExtractGoodTitle($filename) extracts a title from the file GOOD_2.html I haven't included code in the function as my question is related to Line A. In the gooddump directory, following files are present:

  1. GOOD_2.html
  2. GOOD_3.html
  3. GOOD_4.html
    .
    .
    .
    .
  4. GOOD_740.html

Problem Statement:

I am wondering what changes I need make at Line A as GOOD_2.html file may or may not be present in the gooddump directory. Looking for a dynamic solution.

0 Answers
Related