我在使用其他网站server2
访问远程网站server1
的代码时出现问题。我在server2内部用来登录的代码是以下代码:
require_once("http://server2.com/access/models/config.php");
if (!securePage($_SERVER['PHP_SELF'])){die();}
//Prevent the user visiting the logged in page if he/she is already logged in
if(isUserLoggedIn()) { header("Location: http://server2.com/access/account.php"); die(); }
我所知道的是我不能使用require / include代码,因为这些代码用于从服务器内部调用php文件。有人知道从远程服务器登录到另一台服务器的代码的方式,地点或内容是什么?
答案 0 :(得分:2)
由于安全问题,您无法直接查看外部php文件。
如果您想从server2访问信息,我建议您在远程服务器上创建RESTful服务或其他API,以便在服务器之间进行通信。