-2

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?

ProgramFOX
  • 6,131
  • 11
  • 45
  • 51
Ali
  • 9,997
  • 20
  • 70
  • 105
  • What do you mean with 'auto connect'? – Quasdunk Aug 12 '11 at 07:51
  • 1
    you should look into cURL maybe – Ibu Aug 12 '11 at 07:51
  • 3
    This is very bad practice - if the remote site is down, your script will time out. It will also slow down your script considerably even if everything works out well. What are you trying to achieve with this? – Pekka Aug 12 '11 at 07:52
  • the thing is that there is a videos on my site and the site that need to be connect once required to be visit once but don't need to stay or anything just connect even 1 second – Ali Aug 12 '11 at 07:54
  • @ John Green - PageSpike means if you are on my website but you already visit to the other site without you even know... – Ali Aug 12 '11 at 07:56
  • @Ali - Um. Ok, wtf does that mean? Are you trying to pass a cookie? All in all, I can't think of any reasonable reason to do any of this, and it all sounds sort of shady. – John Green Aug 12 '11 at 08:04
  • @John Green - PageSpike there is a website which they provide a free video streaming and in order to watch this you need to login so I got the embed on my website but as I mention you need to login so I ask the provider and they say I can use the link that they give me and make all my visitors to connect once to this to make them able to watch the stream there is no bad behaviour what so ever that I'm doing you can visit my fb fan to check what i'm doing for people http://fb.com/yoursn0w – Ali Aug 12 '11 at 08:07

2 Answers2

2

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> 
grunk
  • 14,718
  • 15
  • 67
  • 108
  • 1
    I wish the OP will never open up remote inclusion. This is very bad. – Shef Aug 12 '11 at 07:57
  • thanks for the tip about the php.ini file that I have to enable but what if I don't want them to even know that they connected to that site? like I want them to stay on my site still? – Ali Aug 12 '11 at 07:57
  • @Shef , i'm agree with you, i said in my answer that it was not safe, beyond that it's not my concern :P – grunk Aug 12 '11 at 08:01
  • @Ali allow_url_fopen is different from allow_url_include. it allow you to do fopen(http://www.google.com) – grunk Aug 12 '11 at 08:02
  • so I couldn't see allow_url_include in the php.ini file do I need to install any extension or I can just add them myself? – Ali Aug 12 '11 at 08:02
  • Available since PHP 5.2.0 , so if you don't have at least this vesrion you can't use it. But be aware off security risk if you use this directive – grunk Aug 12 '11 at 08:06
  • @grunk thanks so will it be any other option than using this? maybe like AJAX? coz I heard that also can be use but I don't know what will be the way to start of – Ali Aug 12 '11 at 08:08
1

maybe you just need this:

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

I'm not sure what you realy need :D

Vytautas
  • 3,509
  • 1
  • 27
  • 43
  • there is no more error when I put that but when I check on the firewall isn't connected to the site? – Ali Aug 12 '11 at 08:12
  • 1
    there is connection between servers user does not see that.. you can read more at http://www.php.net/file_get_contents – Vytautas Aug 12 '11 at 08:20