cybraine cybraine - 3 months ago 7
Javascript Question

How to get the title and description of a site from the URL?

Im sorry because my question is wrong; How to get the title and description of a site from the URL using JavaScript?
Please give me a script and html body code.

Answer
<?php

  $url = "your url Address";

  $fp_open = fopen($url, 'r');
  $content = "";
  while(!feof($fp_open)) {
        $buffer = trim(fgets($fp_open, 4096));
        $content .= $buffer;
  }


  $start = '<title>';
  $end = '</title>';
  preg_match(" / $start( . * )$end / s", $content, $match);
  $title = $match[1];
  $metatagarray = get_meta_tags($url);
  $keywords = $metatagarray["keywords"];
  $description = $metatagarray["description"];
  echo " <div>URL: $url</div> \n";
  echo " <div>Title: $title</div> \n";
  echo " <div>Description: $description</div>\n";
  echo " <div>Keywords: $keywords</div>\n";
?>
Comments