Jump to content

Archived

This topic is now archived and is closed to further replies.

RightNow21

Parse HTML Page

Recommended Posts

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

Share this post


Link to post
Share on other sites
[code=php:0]
/* $File will be a string containing all the HTML for google.com */
$File = file_get_contents("http://www.google.com");
[/code]

Share this post


Link to post
Share on other sites
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;
?>

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.