require_once connect to other website

2019-09-22 07:23发布

问题:

I'm trying to get my visitor when they visit my site to auto connect to the other site once

I did put this

<?php require_once("http://webtoconnect.com");  ?>

but I guess this code wouldn't work it just give me an error something like this

Warning: require_once() [function.require-once]: URL file-access is disabled in the server configuration in /home/yoursn0w/public_html/tv/index.php on line 1

so I wonder how can I do to get my visitor stay in the same page but auto connect once to the site I want?

回答1:

I'm not sure of what you mean by auto connect to the other site but if your goal is to include a remote page in php code you configuration should have the directive :

allow_url_include = On

in your php.ini (available since PHP 5.2.0. Note that directive is set to off by default due to security reason. By using this directive in a none safe environement (typically internet) you will be exposed to major security risk , be aware of that.

If your goal is just display a remote site to you visitor you can simply use an iframe like this :

<iframe src="http://google.fr" height="250" width="350"></iframe> 


回答2:

maybe you just need this:

<?php file_get_contents('http://webtoconnect.com'); ?>

I'm not sure what you realy need :D