There is a problem with uploading files via CURL. However
the issues regarding the symbol as well as
references to url_encoding are not the cause of the bug.
The
symbol is used to send the contents of a file, rather than
the string representation of the file path, to the receiving
script. (See Below)
In other posts on this site references are made to
CURLOPT_POSTFILEDS being populated with an array of post
variables, however the documentation is clear, this variable
is supposed to be a string,....therefore the following
should work.
function Post($vars,$url){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,1);
#curl_setopt($ch,CURLOPT_UPLOAD,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$vars);
curl_exec($ch);
curl_close($ch);
}
$path = "/tmp/test.txt";
$url = "ht
tp://www.somesite.com/receive_changes.php";
$vars =
"action=submitted&order=receive&file= $path";
Post($vars,$url);
Unfortunately this does not work.
----
Server IP: 209.41.74.194
Probable Submitter: 67.188.250.232
----
Manual Page -- http://www.
php.net/manual/en/ref.curl.php
Edit -- https://master
.php.net/note/edit/78328
Del: integrated -- h
ttps://master.php.net/note/delete/78328/integrated
Del: useless -- http
s://master.php.net/note/delete/78328/useless
Del: bad code -- htt
ps://master.php.net/note/delete/78328/bad+code
Del: spam -- https:/
/master.php.net/note/delete/78328/spam
Del: non-english --
https://master.php.net/note/delete/78328/non-english
Del: in docs -- http
s://master.php.net/note/delete/78328/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78328
Reject -- https://mast
er.php.net/note/reject/78328
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|