cURL Upload Help


Posted on 16th Feb 2014 07:03 pm by admin

OK, I am creating a bridge from a local program to my website and I am trying to find the best way to upload the client file from the local program (which is a CSV file) to my server. I was thinking I could use cURL to accomplish this feat. Basically the local program will invoke a batch file that opens my site with the path of the local file (which is the same file name and path everytime), then use cURL to upload that file to my server to be parsed and input into the database. Can this be done?
If so, I would have to just point the cURL to the .php file that would accept the uploaded file correct? And could I use POST for this with multi-form data and not PUT? Any input on this would be great, thanks.
Maybe something similar to this...
Code: $file='testWordDoc.doc';

echo $file;

$ch = curl_init('http://myurl.com/recieve_posted.php');
curl_setopt($ch, CURLOPT_POSTFIELDS, array('file'=>"@$file",'testkey'=>'test value'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
curl_close($ch);
print "$postResult";

No comments posted yet

Your Answer:

Login to answer
223 Like 45 Dislike
Previous forums Next forums
Other forums

MVC - Code review
I'm in the process of trying to wrap my head around MVC, and as part of that, I'm attempting to impl

Sales orders ans reservations not taken into account on MPS / MRP
Hello,

I am implementing the MPS / MRP and I have the following problem:

I ha

PHP Display Telephone Number On Referrer
I have used the php below to show a different telephone number in the header of the site depending u

When i am Canseling the Billing Document in VF11 I am getting Shortdump
Hi Experts

When i am Canseling the Billing Document in VF11 I am getting Shortdump.

Production Order Enterprise Service to Manufacturing Exctn Sys (MES) ???
Hello Experts,

In our current landscape SAP ECC 5.0 is integrated to MES system via PI 7.

Mail Form receiving emails with no content
Hi, I hope someone here can help me.
I have a simple form in my website, it was working OK, after

Remove Rows From Database ad
Hi All,

I have this:

Code: [Select]<?php
session_start();
include('../com

Running External Scripts
I am very new to PHP and am not even sure what I'm asking is possible. I have just installed mediaW

Registration
ok so i have a site where people can register and login which works now thanks to someone on here th

Remove values in array2 from array1
I have two arrays.

Array 1 is where the array key holds various different numbers. For exampl

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash