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";

223 Like 45 Dislike
Previous php-forum Next php-forum
Other php-forum

Custom CMS
This is a big custom CMS script I'd like to develop and would like some help atleast figuring out wh

php web service error
hey guys,
I'm working on a project requires the use of web services. I've been trying a few tutor

Problem with HTML form
Hello,

I made a HTML form with some fields and check box.
Everything works fine except whe

"GROUP BY" in arrays
Well i'm looking to do something i usually could do easily using COUNT and GROUP BY if it was a sql

New Search Engine problem
Hey everyone,

I have a ZIP Code Radius search engine already functional. it displays all of t

Help With editting and deleting form
Hallo !!

So look at this image :

http://img194.imageshack.us/img194/8272/snapshot5f.pn

Not sure why this script is not working?
Hi I am new to php programing and I was trying to make up a simple script like a captcha but I canno

Trouble with a select list
Hello All!
I was wondering if any of you guys could help me with a small problem I'm having!

CURL XML Request [From C to PHP]
Hi,

I need some help converting this into something that will work with PHP.

Code: #

Delete all from a table
I can not get the following code to work. If I run the sql statement in the db it will delete all t

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