开发者

Importing PHP class from remote directory and using it

开发者 https://www.devze.com 2023-03-27 20:19 出处:网络
so what I have is a simple script, set up on two different hosting accounts on the same server, So Account #1 has a file index.php

so what I have is a simple script, set up on two different hosting accounts on the same server,

So Account #1 has a file index.php

<?
function get() {
    return file_get_contents("http://cmyip.com");
}

?>

Account #2 has another file

<?
require_once('../../seaview/public_html/index.php');
echo get();
?>

now开发者_如何学运维 what it would do, is execute it on account #1 and then bring back results, how do I import the function(it will be a class later on) and execute it on account #2, only reason I don't want to just copy paste the files into the second account is because there is going to be a lot of accounts, and managing them would be a pain, also note that the accounts do have different IPs, thats how I know that it's executing on account #1

Please help!


I am assuming shared hosting here, if so unless they have enabled 'allow_url_fopen' including php or reading files from one server to another may not be possible.

Some good info as ever on the PHP Manual: http://www.php.net/manual/en/features.remote-files.php

0

精彩评论

暂无评论...
验证码 换一张
取 消