I have searched and found many "working" examples but every time I try nothing happens. Here is my current code:
$ch=curl_init();
$headers = array(
'X-Atlassian-Token: nocheck',
'Content-Type: multipart/form-data'
);
$data = array('file' => "testing.txt");
curl_setopt_array(
$ch,
array(
CURLOPT_URL=>'https://XXXX.net/rest/api/latest/issue/TSP-78/attachments',
CURLOPT_POST=>true,
CURLOPT_VERBOSE=>1,
CURLOPT_POSTFIELDS=>$data,
CURLOPT_SSL_VERIFYHOST=> 0,
CURLOPT_SSL_VERIFYPEER=> 0,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_HEADER=>false,
CURLOPT_HTTPHEADER=> $headers,
CURLOPT_USERPWD=>"$Jirausername:$Jirapassword"
)
);
$result=curl_exec($ch);
$ch_error = curl_error($ch);
if ($ch_error) {
echo "cURL Error: $ch_error";
} else {
var_dump($result);
}
curl_close($ch);
This returns "string(0) "" " to my webpage when I call this. Attachment it not uploaded. testing.txt is in the same folder the script is being run from. Am I doing the path or something wrong? Please help.
"$Jirausername:$Jirapassword" in php array is wrong format
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.