Enable pay-by-requester using OSS SDK for PHP 2.0
When pay-by-requester is enabled for a bucket, the requester pays the request and traffic fees, and the bucket owner pays only the storage costs. You can enable pay-by-requester for a bucket to share data in the bucket without paying for the request and traffic fees when your bucket is accessed.
Usage notes
-
The sample code in this topic uses the region ID
cn-hangzhouof the China (Hangzhou) region. By default, a public endpoint is used to access resources in a bucket. If you want to access resources in the bucket by using other Alibaba Cloud services in the same region in which the bucket is located, use an internal endpoint. For more information about OSS regions and endpoints, see Regions and endpoints. -
To enable pay-by-requester, you must have the
oss:PutBucketRequestPaymentpermission. To query the pay-by-requester configurations, you must have theoss:GetBucketRequestPaymentpermission. For more information, see Grant a custom policy.
Examples
References
-
For the complete sample code that is used to enable pay-by-requester, visit GitHub.
-
For more information about the API operation that you can call to enable pay-by-requester, see PutBucketRequestPayment.
-
For the complete sample code that is used to query the pay-by-requester configurations of a bucket, visit GitHub.
-
For more information about the API operation that you can call to query the pay-by-requester configurations of a bucket, visit GetBucketRequestPayment.