I'm getting all the contents of a page with the code:
<?php
$url = 'http://www.teste.com.br';
$dadosSite = file_get_contents($url);
echo $dadosSite;
?>
It works normally and was better than using iframe . However, at the top of the page I'm getting, the content has a PHP script that I'd like it to be ignored. Is there any way to do this?
So, I'm using this script to actually get the login page data from pfsense's captive portal, it was the only way I found to make the pfsense login page appear to be called by a friendly url (by name www.xxx.xx.xx). on an internal network. and in case it worked, because the page where the script file_get_contents is is a ubuntu server with dns. So the pfsense login page responds and the user logs in. (do not hesitate to use the page with friendly url it is necessary to use ssl, ie to spend with certificate and still worry about dns for the certificate). What happens is that for this page of the ubuntu server to be called as soon as the user enters the wifi, it must be configured in pfsese so that pfsense directs the original portal page to the ubuntu server. You see? In order to be redirected, you need the script that I said at the beginning of the page, when the pfsense page redirects to the ubuntu server, the ubuntu server page where the file_get_contents script is, takes the pfsense page again and stays as a loop, that is, I believe the redirect script that is at the top of the pfsense page is being included too.Script at the top of the pfsense page.
<?php
require_once("globals.inc");
$request_uri = urldecode(str_replace("/index.php?redirurl=", "",
$_SERVER["REQUEST_URI"]));
$portal_redirurl = urldecode("$PORTAL_REDIRURL$");
if(!stristr(urldecode("$PORTAL_REDIRURL$"), $request_uri)) {
Header("Location: $PORTAL_REDIRURL$");
exit;
} ?>