You are here: Re: Pulling Title Tag out of HTML « PHP Programming Language « IT news, forums, messages
Re: Pulling Title Tag out of HTML

Posted by Ulrich Schmidt-Goertz on 03/02/07 07:49

affiliateian@gmail.com wrote:
> Is there a simple piece of php code(s) that can pull the title of a
> web page out? We need to pull the words in between <title></title> and
> insert it into stumble upon. Here is what their requirements are:
>
> http://www.stumbleupon.com/submit?url=http://www.yoursite.com/article.php&title=The+Article+Title
>
> We have the url but not the title.
>
> The full instructions are here: http://www.stumbleupon.com/integrate.php
>
> Any ideas?

This should be easy with regular expressions. Try something like:

$text = file_get_contents($url);
preg_match('<title>(.*)</title>', $text, $matches);
$title = $matches[1];

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация