So I'm rather new to using cURL in PHP, I was told to use it for a task this week and it's been nothing but a pain, and I can't seem to find a solution to my problem no matter how hard I search.
What I am attempting to do is send a file to an upload directory on my hosted server from a remote portal manager that I have built. The file uploadhandler in the portal manager connects via curl to the remote destination and then the remote destination grabs the info and processes the file like normal. No matter what I've been trying though everything just throws back a failed response.
Here is the updated version of the code I am working with
updates
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, false);
//curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt(
$ch,
CURLOPT_POSTFIELDS,
array(
'file' =>
'@' .$_FILES['doc']['tmp_name'][$i]
.';filename=' .$_FILES['doc']['name'][$i]
.';type=' .$_FILES['doc']['type'][$i]
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//$response = curl_exec($ch);
if(curl_exec($ch) === false){
echo curl_error($ch);
echo curl_errno($ch);
}else{
echo "ok";
}
With all of this information set I am getting no value for curl_error
but I get a value of 43
for curl_errno
.
From what I have been researching, error 43
for curl is
CURLE_BAD_FUNCTION_ARGUMENT (43)
Internal error. A function was called with a bad parameter.
However all my functions for the curl_setopt()
are put together correctly based on the info from php.net. So this is where I am now confused, because I have no idea what is causing this to happen. Thanks again for the help!