including php file from another server with php

Posted by ermac2014 on Stack Overflow See other posts from Stack Overflow or by ermac2014
Published on 2010-05-02T07:41:49Z Indexed on 2010/05/02 7:47 UTC
Read the original article Hit count: 370

Filed under:
|
|
|
|

hi I have 2 php files each file on different server. lets say the first file called includeThis.php and the second called main.php

the first file is located in (http://)www.sample.com/includeThis.php

and the second located in (http://)www.mysite.com/main.php

so now what I want is to include the first file into my second file. the contents of the first file is like:

<?php
$foo = "this is data from file one";
?>

the second file like:

<?php
include "http://www.sample.com/includeThis.php";
echo $foo;
?>

is there any way I can do this?

thanks in advance

© Stack Overflow or respective owner

Related posts about php

Related posts about include