View Full Version : PHP Including Problems
Surya
02-17-2006, 12:13 PM
Thread Deleted
Because you have two HTML documents, one inside the other. You need to use an output buffer to extract the contents of the body from the page you include.
Surya
02-19-2006, 01:20 PM
How to do it output buffer, sorry can u explain in detail pls...
<?php
ob_start();
include("../music/andromeda.php");
$page = ob_get_contents();
ob_end_clean();
$page = explode($page, "body>")[1];
$page = substr($page, 0, strlen($page) - 2);
echo($page);
?>Make sure you don't have any important scripts in the head, because they'll get stripped.
Surya
02-19-2006, 01:35 PM
Thread Deleted
Sorry, you're right.
<?php
ob_start();
include("../music/andromeda.php");
$page = ob_get_contents();
ob_end_clean();
$page = explode("body>", $page);
$page = $page[1];
$page = substr($page, 0, strlen($page) - 2);
echo($page);
?>
Surya
02-19-2006, 01:41 PM
Thread Deleted
Surya
02-19-2006, 01:43 PM
Is there any solution to include???
:confused: :confused: :confused:
... what? I just gave you one...
OK... let's try this.
<?php
ob_start();
include("../music/andromeda.php");
$page = ob_get_contents();
ob_end_clean();
$page = explode("<body", $page);
$page = $page[1];
$page = explode(">", $page);
$page = $page[1];
$page = explode("</body>", $page);
$page = $page[0];
echo($page);
?>
Regex would be much more elegant here, but PHP seems to have a problem with character classes I can't quite understand.
Surya
02-19-2006, 06:38 PM
the last code you gave me, shows only a blanc page....:confused: :confused:
What is Regex??
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.