extract HTML

A

Anonymous

Guest
I would like to read an html document from a website into an array or variable of some sort in php. My goal is to have a web page that has dynamic data from another page.
 
ok maybee I wasnt specific enough. Lets say I want to extract the html from yahoo into an array.
What i want is something like
$array = http://www.yahoo.com
then i can go through and parse the html to get the desired text.

what is the best way to do this?
 
I tried fread with $filename = http://www.yahoo.com. It didnt work
 
Ok im alot closer to my solution. I can read in a html page from the web into an array. But what i need to do is read in the html output from a php page.
 
No offence, but learn some basics of php. The questions you are asking are from the absolute most basic tutorials. To output the array use echo() or print()
 
No offence taken, I once again misstated my question. I know how to print an array while in php. What I want to do is extract information from a php generated page. For instance lets say I have a page http://www.mydomain.com/test.php This page contains a print statement that prints "Hello world!". I want to navigate to this page through php and extract the generated html. But if I make the filehandle of a fread statement http://www.mydomain.com/test.php it doesnt output anything. Probably because my php script doesnt have permission to read the php script of another page. But im not interested in the script just the html that that script generates. Heres an example of the code that im working on. This code reads a html page from the internet and then spits it right back out.
Code:
<?php
	$filename = "http://www.gnu.org/copyleft/gpl.html";
	$handle = fopen ($filename, "r");
	$contents = fread ($handle, 5000);
	fclose ($handle);
	echo $contents;
?>
Notice the page im reading is an html page so it works. I want to be able to do the same with the html generated by a php page.
The reason I want to do this is i want to create a page for some people who dont want to give up their current web page system(which alows them to update the site rather easily with no programming skill). So what I want to do is create a php shell that will extract the information from their current page and then go into whatever format I choose. Their using tiki wiki if you are familiar with that. Which while it is easy to use doesnt provide enough customizability for my tastes.
Thanks for all your help so far everyone
-Smoker
 
I'm not sure how to help, I just tried that code with the html file you specified, then a php file I had and they both worked... could you maybe give more details of what you are doing specifically?
 
Back
Top