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';
Did you know?Explore Trending and Topic pages for more stories like this.
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
45
Other forums
IF Statement & Two Tables With Different Echoes
I'm retrieving two tables in a single query using UNION ALL, like so:
Code: $query = "SE
Unable to customise toolbar in FCK
Had a simple form script that suddenly stopped working
It was made about a year ago and had been working fine. Last time it was known to work for sure was
str_replace help
I am thinking str_replace is my only option to filter outputs from my database to convert them to sa
Converting RGB values to HEX
Code: <?PHP
$file_handle = fopen("colors/rgb.csv", "r");
wh
Captcha problem users just refresh and it will let them auto submit again
Users will just re submit and not have to enter the new captcha.. ? Lol but if i refresh the page, t
Product categories for registration
Dear all,
We are going live with the Supplier registered next week. At standard, the 'sel
opening a window with after form submission
I know this this forum has nothing to do with JS, but i'm trying to use it with my php script.
<
PHP referral database. I would like this form to email the referrer.
Okay, Hello I've been trolling for years. This the first time I've ever asked for php help. Normally
Why use OOP?
Can someone explain to me why I should use OOP instead of procedure based code.
Im building a