2

I want to send a CURL request and receive a response, both in JSON

But I don't know how to make the CURL request.

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"}
}'

This should put something in PHP, but I'm not sure how, I found something that has not helped me.

Community
  • 1
  • 1
Mubby
  • 95
  • 1
  • 12
  • The examples in the question you've found look pretty nice, if you explain **why** they didn't helped you maybe someone will be able to help you – Teneff Mar 04 '15 at 17:04
  • @Teneff, Your comment is completely pointless. You've probably misunderstood assignment. Unfortunately. – Mubby Mar 04 '15 at 17:31
  • It is not Teneff’s fault. Your question does not make sense to me. Are you asking us to rewrite the shell code you provided to PHP? – Palec Mar 05 '15 at 21:04
  • Hey there. I've first corrected the grammar of the text to make it easier to understand. I've removed repetition in the text, and generally made it more straightforward. It is better if a question can be read faster. You should include any error messages if you have them, and clarify what you expect. – Félix Adriyel Gagnon-Grenier Mar 05 '15 at 21:21
  • I have already solved it using another function that a site had to offer. – Mubby Mar 10 '15 at 19:14

0 Answers0