require_once connect to other website

别来无恙 提交于 2019-12-13 09:09:56

问题


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



来源:https://stackoverflow.com/questions/7037051/require-once-connect-to-other-website

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!