I am working on a project where I use two separate servers, one for the development and one for the visible version. This is how the process works, and where I'm having troubles: Every morning, I run some VBA macros that collects data, compiles that data (mainly .xlsx files) and sends it to my development server via FTP. The visible server is supposed to use that data to display some informations etc, but FTP is blocked on that server.
Because of that, I have to copy everything from my development server to the visible server every morning, so that the data on the visible server is updated, and I'd like to automatize that.
I tried sending the data from the VBA macros directly to the visible server via HTTP Requests (WinHTTPRequest to be exact) but that didn't work.
I searched online and found that cURL can send HTTP requests through PHP, and i'd like to use that solution if possible, here is my current code:
send.php:
<?php
$request = curl_init('mysite/receive.php');
curl_setopt($request, CURLOPT_POST, true);
curl_setopt($request,
CURLOPT_POSTFIELDS,
array(
'file' => '@MyFileRealPath.xlsx;filename=file'
));
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($request);
curl_close($request);
?>
receive.php:
<?php
var_dump($_FILES);
?>
When I run send.php, I get:
array(0) { }
So the receive.php file does not get any file, does someone know how to fix that?
If what I'm trying to do is not possible, does someone know any other way that I could try to send the files from the development server to the visible one?
Thanks and sorry for my not perfect english, I'm not a native speaker.
Have a nice day!