Jump to content

Obtaining Page Title


Maverickb7

Recommended Posts

I was wondering if someone could tell me the easiest way to obtaining the page title of a specific url? I've tried to use fopen and those functions but I got the below error.

 

Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /home/web/ute.php on line 2
Link to comment
Share on other sites

Alright i'm trying to get my host to enable url_fopen but until then I still have to find a work around. I'm searching for these terms on google and I'm not coming up with many helpful examples. What would I search for using google? Sorry if I'm coming off as a n00b, just trying to get my head in this stuff.

Link to comment
Share on other sites

// For Greter version of PHP

 

function get_string_between($string, $start, $end){

        $string = " ".$string;

        $ini = strripos($string,$start);

        if ($ini == 0) return "";

        $ini += strlen($start); 

        $len = strripos($string,$end,$ini) - $ini;

        return substr($string,$ini,$len);

}

ob_start();

readfile('http://www.rediff.com');

$con = ob_get_clean();

$filecontents = htmlentities($con);

echo get_string_between($filecontents,"<title>","</title>");

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.