简体   繁体   English

PHP:将数据从一个php数据库应用程序移动到另一台服务器上的另一个

[英]PHP: Move data from one php database app to another on a different server

I have two php database apps on different servers. 我在不同的服务器上有两个php数据库应用程序 I would like to be able to transfer the data from a particular record from the first server to the second, with some processing inbetween to account for the differences in database schema. 我希望能够将特定记录中的数据从第一个服务器传输到第二个服务器,并在其间进行一些处理以解释数据库模式的差异。 The two servers cannot access each others databases. 这两个服务器无法访问彼此的数据库。 So the user would click a link on the record and then basically that data would be transferred over to the other server for confirmation. 因此,用户将单击记录上的链接,然后基本上将该数据传输到另一个服务器以进行确认。 I looked at a redirect with POST, but that doesn't seem to be possible. 我看了一下POST的重定向,但这似乎不可能。 Any better ways? 有更好的方法吗?

Select record on server 1 -> Process record to correct form -> transfer PHP array to server 2 -> confirmation page on server 2 选择服务器1上的记录 - >进程记录以更正表单 - >将PHP数组传输到服务器2 - >服务器2上的确认页面

If I had to do something like this, I'd take my data that needs to be processed, process it on my server (from where I take it) then serialize result and send it to another server using post method. 如果我不得不做这样的事情,我会拿出需要处理的数据,在我的服务器上处理它(从我接收它)然后序列化结果并使用post方法将其发送到另一台服务器。 Using another script unserialize and simply store in a database that runs on the second server. 使用另一个脚本反序列化并简单地存储在第二个服务器上运行的数据库中。

you can use curl as i mentioned with the help of this example 你可以使用我在这个例子的帮助下提到的卷曲

//assuming the variable that holds your record is $row
$row = array("key1" => "value1", "key2" => "value2");
$post_fields = "";
foreach($row as $key=>$field){
    $post_fields .= $key . "=" . $field . "&";
}
 $Curl_Session = curl_init('http://yourseconddomain.com/yourfile.php');
 curl_setopt ($Curl_Session, CURLOPT_POST, 1);
 curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, $post_fields);
 curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
 curl_exec ($Curl_Session);
 curl_close ($Curl_Session);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将数据库表从一台服务器发送到另一台服务器中的另一数据库表PHP MySQL - Send database table from one server to another database table in different server PHP MySQL 如何使用PHP将一组特定的用户数据从一个MySQL数据库移动到另一个数据库? - How can I move a specific set of user data from one MySQL database to another with PHP? PHP脚本将目录从一台Linux服务器移至另一台? - PHP script to move a directory from one Linux server to another? 使用PHP将文件从一台服务器移动到另一台服务器的最佳方法是什么? - What is the best way to move files from one server to another with PHP? 在PHP中将数据从一台服务器传输到另一台服务器 - Transferring data from one server to another in php 用php将一行移到数据库表中的另一行 - Move with php one row to another in database tables php将数据从一种形式移动到另一种形式但具有多个输入ID - php move data from one form to another but with multiple input ids 使用PDO PHP将数据从一个表移动到另一个表 - Move Data from one table to another table using PDO php 如何使用PHP将数据库从一台服务器复制到另一台服务器? - How to copy a Database from one server to another server in PHP? 使用PHP从一个SQL数据库中获取数据并将其插入到另一个SQL数据库中 - Using PHP to take data from one SQL database and inserting it into another
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM