Jump to content


Photo

Parse HTML Page


  • Please log in to reply
2 replies to this topic

#1 RightNow21

RightNow21
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 15 August 2006 - 06:53 PM

Any one know how to parse an external html page?

I know how to parse a html file on my server.

<?php
$filename = "test.html";
$file = fopen($filename, "r");
$filesize = filesize($filename);
$text = fread($file, $filesize);
fclose($file);
echo $text;
?>

But how would I parse:
someone-else.com/filename.html

#2 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 15 August 2006 - 07:04 PM

/* $File will be a string containing all the HTML for google.com */
$File = file_get_contents("http://www.google.com");


#3 RightNow21

RightNow21
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 15 August 2006 - 07:11 PM

Thanks!!!!!
Works like a charm.

http://www.darynduff.com/crawler/

<?php
$file = file_get_contents("http://www.google.com");
//$file = fopen($filename, "r");
//$filesize = filesize($file);
//$text = fread($file, $filesize);
//fclose($file);
echo $file;
?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users