I have an Excel file that I need to send data from to my Drupal MySql database. To do that, I am using an HTTP POST from within the VBA of my Excel sheet as follows:
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = "http://localhost:8082/acquia-drupal/node/2"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.send ("string=testdata")
I want to use a Drupal page that will parse out the POST data and write it to a table in the Drupal MySql database.
Here is what I have started with,
<?php
if (isset($_POST['string']))
{
$trans = $_POST['string'];
db_query("INSERT INTO {excel} (ExcelData) VALUES (%d')",
$trans);
}
Is this the right direction to go in? Also, could someone provide some code snippet guidance on parsing out the POST data correctly?