如何使用PHP发布curl

时间:2017-01-05 03:29:08

标签: php json curl

我正在使用需要使用CURL的API。

以下是代码:

    <?

curl -v -X POST https://sandbox.bluesnap.com/services/2/transactions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '


{
"amount": 11,
"recurringTransaction": "ECOMMERCE",
"merchantTransactionId": 3,
"softDescriptor": "DescTest",
"cardHolderInfo": {
    "firstName": "test first name",
    "lastName": "test last name"
},
"currency": "GBP",
"creditCard": {
    "expirationYear": 2018,
    "securityCode": 837,
    "expirationMonth": "02",
    "cardNumber": 4263982640269299
},
"cardTransactionType": "AUTH_CAPTURE"
}'


?>

请准确转换CURL代码,使其在PHP中运行。

1 个答案:

答案 0 :(得分:0)

等效的PHP curl调用

{{1}}

https://github.com/dennygajera/gifToMp4