$merchantId, 'serial' => $merchantCertificateSerial, 'privateKey' => $merchantPrivateKeyInstance, 'certs' => [ $platformCertificateSerial => $platformCertificateInstance, ], ]); $media = new MediaUtil('/your/file/path/image.jpg'); $resp = $instance->v3->marketing->favor->media->imageUpload ->postAsync([ 'body' => $media->getStream(), 'headers' => [ 'content-type' => $media->getContentType(), ] ]) ->then(static function($response) { echo $response->getBody()->getContents(), PHP_EOL; return $response; }) ->otherwise(static function($exception) { if ($exception instanceof \Psr\Http\Message\ResponseInterface) { $body = $exception->getResponse()->getBody(); echo $body->getContents(), PHP_EOL, PHP_EOL, PHP_EOL; } echo $exception->getTraceAsString(), PHP_EOL; }) ->wait();