$ak, 'secret' => $sk, 'endpoint' => $endpoint, 'socket_timeout' => 30, 'connect_timeout' => 10 ] ); try { printf("Create a new bucket for demo\n\n"); $obsClient -> createBucket(['Bucket' => $bucketName]); /* * Step 1: initiate multipart upload */ printf("Step 1: initiate multipart upload\n\n"); $resp = $obsClient -> initiateMultipartUpload(['Bucket'=>$bucketName, 'Key'=>$objectKey]); $uploadId = $resp['UploadId']; /* * Step 2: upload a part */ printf("Step 2: upload a part\n\n"); $resp = $obsClient->uploadPart([ 'Bucket'=>$bucketName, 'Key' => $objectKey, 'UploadId'=>$uploadId, 'PartNumber'=>1, 'Body' => 'Hello OBS' ]); $etag = $resp['ETag']; /* * Step 3: complete multipart upload */ printf("Step 3: complete multipart upload\n\n"); $obsClient->completeMultipartUpload([ 'Bucket'=>$bucketName, 'Key'=>$objectKey, 'UploadId'=>$uploadId, 'Parts'=>[ ['PartNumber'=>1,'ETag'=>$etag] ], ]); } catch ( ObsException $e ) { echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; echo 'Request ID:' . $e->getRequestId () . PHP_EOL; echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; } finally{ $obsClient->close (); }