Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
213 views
in Technique[技术] by (71.8m points)

php - require_once connect to other website

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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> 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...