Picking up content from a page with PHP

Asked

Viewed 745 times

1

I’m taking all the contents of a page with the code:

<?php
$url = 'http://www.teste.com.br';
$dadosSite = file_get_contents($url);
echo $dadosSite;
?>

Works normally and was better than using iframe. However, at the beginning of the page I’m picking up, the content has a script PHP that I would like to be ignored. Does it have any way to do this?


So man, I’m using this script actually to get the login page data from pfsense’s captive portal, it was the only way I could find to make the pfsense login page appear by being called by a friendly url (by the name www.xxx.xx.xx). this on an internal network. and in this case it worked, because the page where the file_get_contents script is is a Ubuntu server with dns. So the pfsense login page responds and the user login. (in pfsese to use the page with friendly url is necessary to use ssl, ie 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 needs to be configured in pfsese so that pfsense directs the original page of the portal to the Ubuntu server. Do you understand? In order to be redirected, you need the script I mentioned 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 always looks like a loop, that is, I believe that the redirect script that is at the beginning of the pfsense page is being included as well.

Script at the beginning 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;
} ?>
  • What do you mean a PHP script at the beginning? With this code you would only be getting the source code of the page; PHP should not be present. There is how to improve this information and put an example of what script this would be?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.