You are here: [regex] Why doesn't preg_replace work? « PHP Programming Language « IT news, forums, messages
[regex] Why doesn't preg_replace work?

Posted by Gilles Ganault on 05/07/07 23:30

Hello

I went through some examples, tried a bunch of things... but still
can't figure out why I can't extract the TITLE section of a web page
using preg_replace():

-----------
<?php

$url = "http://www.cnn.com";

$response = file_get_contents($url);

$output=preg_replace("|<title>(.+?)</title>|smiU",
"TITLE=$1",
$response);

$fp = fopen ("output.html", "w");
fputs ($fp,$output);
fclose($fp);
-----------

Any idea?

Thanks!

 

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

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