如何使用JSON通过CURL发送PHP请求

时间:2015-03-04 16:56:54

标签: php json curl

我想发送一个CURL请求并在JSON

中收到响应

但我不知道如何发出CURL请求。

curl -v https://testgw.gopay.cz/api/payments/payment \
-X"POST" \
-H"Accept: application/json" \
-H"ContentType:application/json" \
-H"Authorization: Bearer xzZnu3YnAHRk298EsmyttFQMcbCcvmwTKK5hrJx2aGG8ZnFyBJhAvFWNmbWVSD7p"
\
-d'{
"payer": {
     "payment_instrument":"PAYMENT_CARD",
     "contact":{"first_name":"Zbynek","last_name":"Zak",
            "email":"zbynek.zak@gopay.cz","phone_number":"+420777456123",
            "city":"C.Budejovice","street":"Plana 67","postal_code":"373 01","country_code":"CZE"}
},
"target": {
        "type":"ACCOUNT",
        "goid":"8123456789"
},
"amount":"1000",
"currency":"CZK",
"order_number":"001",
"order_description":"pojisteni01",
"items":[{"name":"item01","amount":"500"},{"name":"item02","amount":"500"}],
​"preauthorization":"true",
"additional_params":[{"name":"invoicenumber","value":"2015001003"}],
"callback":{"success_url":" http://www.eshop.cz/success ","failed_url":" http://www.eshop.cz/failed ","notification_url":"
http://www.eshop.cz/notify"}
}'

这应该放在PHP中,但我不确定如何,I found something没有帮助我。

0 个答案:

没有答案