Simple HTML Dom is an excellent script in PHP to play with HTML in an easy and efficient way. I have used this script in a couple of my projects. Recently I was using this script in a customized version of Kish Twit Pro where I wanted to crawl through the tweeted URL and get some information from that page.
I was facing some problem get the
meta description
tag of an URL. I tried Googling initially, but could not find a solution and this worked for me.
include_once('simple_html_dom.php');
$html = new simple_html_dom();
$html->load_file($surl);
foreach($html->find('title') as $element) {
$title = $element->plaintext;
}
foreach($html->find('meta[name=description]') as $element) {
$desc = $element->content;
}
include_once('simple_html_dom.php'); $html = new simple_html_dom(); $html->load_file($surl); foreach($html->find('title') as $element) { $title = $element->plaintext; } foreach($html->find('meta[name=description]') as $element) { $desc = $element->content; }
An alternative way is to use the
get_meta_tags($url)
You can download the Simple HTML Dom Parser Script here.
You can download the Simple HTML Dom Parser Script here.
Related posts:
- All in One Seo Plugin and Twenty Ten Theme : Issue with Title when Re-Write Title Enabled After upgrading to WordPress 3.0, I changed my theme to...
- Taking care of your WordPress Blog Search Engine Optimization I have been using WordPress for more than 6 years...
- Registering a Twitter Application Twitter has a feature where you can write your own...
- Tweeting from Google Reader Google Reader is something what I use to aggregate all...
You should have got the notification to upgrade your WordPress Installation. Most of us do it instan →
There are many blogging softwares like Joomla, WordPress, Drupal, etc, but I would suggest you to go →
I always wait for beta releases and love to test it and try to know about the new features, and also →