无需下载直接将联系人导出到数据库

Exporting contact's directly to database without downloading

我是looking/making剧本。我只是不确定它是否会起作用。我有一些使用 prestashop 和 magento 的在线商店。用户可以在那里订阅时事通讯。每次我想导出订阅者时,我都需要下载 .csv 文件并将其上传到我的订阅者所在的数据库。 我想制作或找到一个允许我点击导出的脚本,该脚本应将联系人直接导出到订阅者的数据库,而无需下载文件。

我正计划用类似的东西更改现有的导出脚本,这是否合适,或者有人有更好更简单的解决方案吗?:

<?php

$host="localhost";
$username="root";
$password="";
$db_name="test";
$tbl_name="subscribers";

$link = mysql_connect("localhost", "root", "") or die ("error");
mysql_select_db("test", $link) or die ("Connection fail");

$id = $_POST['id']; 
$userID = $_POST['userID'];
$name = $_POST['name'];
$email = $_POST['email'];
$custom_fields = $_POST['custom_fields'];
$list = $_POST['list'];
$unsubscribed = $_POST['unsubscribed'];
$bounced = $_POST['bounced'];
$bounce_soft = $_POST['bounce_soft'];
$complaint = $_POST['complaint'];
$last_campaing = $_POST['last_campaing'];
$last_ares = $_POST['last_ares'];
$timestamp = $_POST['timestamp'];
$join_date = $_POST['join_date'];
$confirmed = $_POST['confirmed'];
$messageID = $_POST['messageID'];

$sql="INSERT INTO test(id, userID, name, email, custom_fields, list, unsubscribed, bounced, bounce_soft, complaint, last_campaing, last_ares, timestamp, join_date, confirmed, messageID)VALUES('$id', '$userID', '$name', '$email', '$custom_fields', '$list', '$unsubscribed', '$bounced', '$bounce_soft', '$complaint', '$last_campaing', '$last_ares', '$timestamp', '$join_date', '$confirmed', '$messageID')";
$result=mysql_query($sql);

if($result){
   echo "error";
}
?>
<?php
 mysql_close();
?>

我想你可以得到一个模块。但是该脚本将不起作用。您需要查看您的服务器是否授予对商店数据库的远程访问权限并使用正确的路径。