PHP - 使用https通过curl发送文件

I am trying to send file via curl, but keep getting this error:

PHP Notice:  Array to string conversion in /home/sasha/Documents/OffProjects/test/index.php on line 26

This is my code at the moment:

    $target_url = 'https://address';
    $file_name_with_full_path = realpath('mpthreetest.mp3');

      $post = [
          'textNote'     => 'This is test',
          'audioFile'    => '@'.$file_name_with_full_path,
          'department'   => 'Test',
          'timeDetected' => round(microtime(true) * 1000),
          'subjectLine'  => 'Test Test',
          'recipients'   => ['phone-number' => '111111111']
          ];

      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL,$target_url);
      curl_setopt($ch, CURLOPT_PORT, 443);
      curl_setopt($ch, CURLOPT_POST,1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
      curl_setopt($ch,CURLOPT_FOLLOWLOCATION, true);

      $result=curl_exec ($ch);
      curl_close ($ch);

  echo $result;

How can I make this working?

You can't have an array as a value, it's trying to convert the post data into a string. Check what the website you are posting to is expecting for "recipients", my guess would be some form of JSON string.

When you pass an array to CURLOPT_POSTFIELDS it will try to build a form-data content (see http://php.net/manual/en/function.curl-setopt.php for details).

But you have nested arrays here:

....
'recipients'   => ['phone-number' => '111111111']
...

and this cannot work. You'll have to find a different way to pass multiple values as recipients, either as a JSON string as @fire mentioned, or with a serialized value, or whatever transformation you prefer.