function get_meta_content($file){ $h1count = preg_match_all('/(<meta)(.*="(.*)").\/>/ix',$file,$patterns); $res = array(); array_push($res,$patterns[2]); array_push($res,count($patterns[2])); return $res; } $webPageAsString=file_get_contents("http://www.indyarocks.com/login.php"); $meta=get_meta_content($webPageAsString); print_r($meta[0]); On Wed, Jan 13, 2010 at 9:30 AM, Sovichea SOU <svch_sou@xxxxxxxxxxx> wrote: > Thanks for your reply. > > I get an error: *Notice*: Undefined variable: s in > *C:\wamp\www\test3.php*on line > *8 > > *any idea? > > > Many thanks, > > Vichea > > On Wed, Jan 13, 2010 at 11:51 AM, Edward Willekens < > edwardwillekens@xxxxxxxxx> wrote: > > > > > > > <?php > > # get the website page into a string > > $webPageAsString=file_get_contents("websiteUrl"); > > > > $startScanAt=0; > > while (($metaAt=stripos($webPageAsString,"<meta",$startScanAt)) !==FALSE) > { > > $startScanAt= $metaAt+5; > > if (($metaEndAt=stripos($s,">",$startScanAt)) !==FALSE) { > > print substr($s,$metaAt,$metaEndAt-$metaAt+1)."\n"; > > } > > else { > > break; > > } > > } > > ?> > > > > Regards, > > Edward Willekens > > > > --- On Tue, 1/12/10, Sovichea SOU <svch_sou@xxxxxxxxxxx<svch_sou% > 40yahoo.co.uk>> > > wrote: > > > > From: Sovichea SOU <svch_sou@xxxxxxxxxxx <svch_sou%40yahoo.co.uk>> > > Subject: How to retrieve html code from website with php > > To: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com> > > Date: Tuesday, January 12, 2010, 5:22 AM > > > > > > > > > > Hi, > > > > I want to retrieve meta tag from some websites by using php. > > > > Any helps? > > > > Many thanks, > > > > Sovichea > > > > [Non-text portions of this message have been removed] > > > > [Non-text portions of this message have been removed] > > > > > > > > > [Non-text portions of this message have been removed] > > > > ------------------------------------ > > Are you looking for a PHP job? > Join the PHP Professionals directory Now! > http://www.phpclasses.org/jobs/ > Yahoo! Groups Links > > > > -- Regards.. Jobin Mani [Non-text portions of this message have been removed]