Google+SitemapRSS
Loading..

In this tutorial am going to explain how to get meta data from an URL to display in website. It’s similar to URL data extracting. You can see this example most of social networking sites like Facebook and Google Plus. It also called as Extracting data from URL using Jquery, Ajax and PHP.

Fetch Meta Data form URL using PHP and Ajax

Download FileDemo

I have used get_meta_tags PHP function to get the Meta data from URL. This is a PHP in built function. The output will be returned in array.

$url=get_meta_tags("http://www.webinfopedia.com/"); 
This will give you an array of all Meta data like Description, Keyword, Author, Copyright, Robot etc... Now you need to display it like below.
echo ($url["description"]);
echo substr($url["keywords"], 0, 128); 
echo ($url["copyright"]);
To get the title tag form URL am using file_get_contents function.
echo get(file_get_contents('http://www.webinfopedia.com/'), "", "");
//get function 
function get($a,$b,$c)
{
 // Gets a string between 2 strings
$y = explode($b,$a);
$x = explode($c,$y[1]);
return $x[0];
}
Using same this method you can also fetch the first image from URL. Check the function below:
echo get(file_get_contents(''.$_REQUEST['url'].''), "");

Related Post

Admin
Friday-Nov-2011 | 10:32:24 AM
Sure...
Data Extract
Friday-Nov-2011 | 7:30:19 AM
Hello, Wow so nice! I like this site. Keep it working every day.
Tester
Friday-Jan-2012 | 3:14:35 PM
Is there a way to allow user to select the types of images from the target hyperlink?
Web Data Harvesting
Tuesday-Feb-2012 | 12:36:42 AM
Hi, This is a really good read for me, Must admit that you are one of the best blogger I ever saw.Thanks for posting this informative article.
chris
Sunday-Feb-2012 | 4:23:0 AM
i really like your work, i would like to find a way to extend it so that it would fill a form value rather than html output, i tried various ways but since i'm a beginner i can't get it to work properly any help please
Name

Email

Comments

Enter Code
captcha image

auther
Blogger,Web Designer, Developer, Programmer
Subscribe via email to get updates

Category

The right Horizontal Machine or precision High Metal Removal Rate Machining
Copyrights © 2011 Webinfopedia. All rights reserved.