Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Get the title and meta tags from a url in php

    • 0
    • 1
    • 1
    • 2
    • 0
    • 0
    • 0
    • 0
    • 422
    Comment on it

    To get the title and meta tags from a website you can use the following code :

    function getTitle($Url){
            $str = file&#95;get&#95;contents($Url);
                    return $title[1];
    echo 'TITLE :'.getTitle("");
    // Assuming the above tags are at
    $tags = get&#95;meta&#95;tags('')
     or die("Could not fetch meta tags");
    // Notice how the keys are all lowercase now, and
    // how . was replaced by _ in the key.
    echo 'AUTHOR '.$tags['author'].'<br/>';      // name
    echo 'KEYWORDS '.$tags['keywords'].'<br/>';    // php documentation
    echo 'Description '.$tags['description'].'<br/>';  // a php manual
    echo 'Location '.$tags['geo&#95;position'].'<br/>'; // 49.33;-86.59


    TITLE International - Breaking, World, Business, Sports, Entertainment and Video News

    CNN, CNN news, CNN International, CNN International news, CNN Edition, Edition news, news, news online, breaking news, U.S. news, world news, global news, weather, business, CNN Money, sports, politics, law, technology, entertainment, education, travel, health, special reports, autos, developing story, news video, CNN Intl, podcasts, world blogs

    Description International delivers breaking news from across the globe and information on the latest top stories, business, sports and entertainment headlines. Follow the news as it happens through: special reports, videos, audio, photo galleries plus interactive maps and timelines.

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: