Page 1 of 1

How to include file from external domain

Posted: Fri Jul 20, 2007 4:57 am
by arathi
Hi
I want to include file from external domain.
for example i have 2 domains http://www.hiox.com and http://www.withfriendship.com i have a php script on example.com which i want to include in another script on example2.com.

I tried to just simply include the script:

include('http://www.hiox.com/testscript.php');

but this does not seem to work. When I checked the manual it said that this is possible as long as the php version is greater than 4.3.0 (which mine is on both domains) and allow_url_fopen is enabled ehich it is on both domains.

am i missing something? or is there another way of doing this?

Posted: Fri Jul 20, 2007 5:03 am
by MalikBB
it-s impossible

because another site is another site.

with same result you can include google.com/index.php :)

Posted: Fri Jul 20, 2007 5:19 am
by volka
arathi wrote:include('http://www.hiox.com/testscript.php');
if the webserver at hiox.com has php installed your script will only include the output of testscript.php
e.g.

Code: Select all

// testscript.php
if ( isset($a) ) {
  echo $a;
}
else {
  echo 'default';
}
and your script:

Code: Select all

$a = 'xyz';
include include('http://www.hiox.com/testscript.php');
Your script will only receive default as data for inclusion.

Posted: Fri Jul 20, 2007 5:32 am
by Phoenixheart
:D If only we could include() something from other sites :lol: I'd be a hacker master... or not? Since no security, no hacker. :lol:

Posted: Fri Jul 20, 2007 5:36 pm
by feyd
Also be aware that including from off site will often significantly slow the execution of the page and creates a security hole by allowing an attacker compromise one site and compromise another for free.