Forum Moderators: coopster
Second question is: Is there a php function to have an include page that just includes the HTML in between the <BODY> tags onto the page?
Thanks!
Second question is: Is there a php function to have an include page that just includes the HTML in between the <BODY> tags onto the page?second question - no, you need to read in the file and run a regular expression to grab the contents between the body tags
What aboult reading in the body from another webpage on another server? although I think it would just be easier to use frames and frames was my first thought.
<?php include("any.html")?>
Yes that works to, that is a semi shortened version of embedding PHP within HTML, when doing it in shorthand like this the ; is not always required, for example <?=$var?> would output the value of $var (notice the missing 'php' and the use of the = instead of echo, also no ; at the end).
Also note that although include is understood by some to be a function, may people do not class it as a function - i.e. you do not need to brackets.... for example:
<?
include 'page.php';
?>
is perfectly feasible.
What aboult reading in the body from another webpage on another server? although I think it would just be easier to use frames and frames was my first thought.
You can read files in from any server (providing you have access) - for example you can use:
if(!$fp = fopen("http://www.google.com", "r")) {
die("Cannot open google.com.");
}
$contents = (string) fread($fp, 2000000);
This would place all the HTML from google.com in the variable $contents. The regular expressions can be applied before echo'ing out the string.