Hello,
I am trying to upload a file to my private repository.
I have read:
https://stackoverflow.com/questions/20302524/upload-file-to-bitbucket-via-php-script
App password is created.
this is my code:
$file_git = "test.jpg";
$data_string_git = [ 'files' => curl_file_create($file_git),];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.bitbucket.org/2.0/repositories/USERNAME/REPO/src/".urlencode("test.jpg"));
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string_git);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_USERPWD, "USERNAME:APP_PASS");
curl_setopt($ch, CURLAUTH_BASIC, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$result = curl_exec($ch);
I am not sure should I specify additional data for the commit for example and author.
Can you please let me know where is the problem?
thank you
Community moderators have prevented the ability to post new answers.