我有我的2个不同的服务器。我需要使跨域请求服务器端
我使用一台服务器来管理所有的数据和系统。
另一台服务器只是为了给用户点数。
我需要在服务器端的第一台服务器中打电话给php, 给第二台服务器,并从服务器获得响应。
例在PHP中:
$response = getDataFromOtherServer("http://otherServer.com");
// manipulate response
我有我的2个不同的服务器。我需要使跨域请求服务器端
我使用一台服务器来管理所有的数据和系统。
另一台服务器只是为了给用户点数。
我需要在服务器端的第一台服务器中打电话给php, 给第二台服务器,并从服务器获得响应。
例在PHP中:
$response = getDataFromOtherServer("http://otherServer.com");
// manipulate response
你可以做这样的事情
$response = fopen("http://otherServer.com?var1=some&var2=thing","r");
可以获取数据之间从2台服务器,通过改变像主机1
连接到这些服务器切换mysql_connect('host1','username','password')
为host1执行数据并保存。现在,当你需要从主机2数据从菲尔鲟鱼连接到和操纵数据
使用REST API - >
REST服务器: https://github.com/philsturgeon/codeigniter-restserver
REST客户端: https://github.com/philsturgeon/codeigniter-restclient
假设您的数据服务器上有Web服务,则可以使用CURL向该服务发出HTTP请求。 http://php.net/manual/en/book.curl.php
你有权访问两台服务器吗? – gorelative 2012-02-08 14:15:08