help with regular expression
| From: | php at flysurfing dot com | Date: | Thu, 18 Nov 1999 18:03:05 +0000 |
| Subject: | help with regular expression | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-12735@lists.php.net to get a copy of this message | ||
Hi !
Actually I'm building a small program that could allow the user to know the title the keywords
and the description of an HTML page.
I don't know how to built a optimized regular expression to parse the string I get from an
fgets after a fsockopen.
I need to get back in several variables the value of the title, keywords and description (both in
meta tag).
Do you think it is possible ?
Thank you for your help.
Here is my source code.
Alex
<?
$serveur = "www.php.net";
$fp = fsockopen("$serveur", 80);
if($fp == 0);
echo "$fp<br>\\n";
else;
fputs($fp,"GET / HTTP/1.0\\n\\n");
while(!feof($fp));
$string = fgets($fp,128);
/********
I don't know what to put here
*********/
if (ereg("<title", $string, $reg));
echo "***$regs[1]";
endif;
endwhile;
fclose($fp);
endif;
>