arrays - php how to send this data threw curl -


i have send data threw curl:

-d '{"payer": {         "default_payment_instrument":"bank_account",         "allowed_payment_instruments":["bank_account"],         "default_swift":"fiobczpp",         "contact":{"first_name":"first",                    "last_name":"last",                    "email":"first.last@example.com"         }     }, }' 

how supposed save data fields variable?

$fields = {   "payer": {         "default_payment_instrument":"bank_account",         "allowed_payment_instruments":["bank_account"],         "default_swift":"fiobczpp",         "contact":{"first_name":"first",                    "last_name":"last",                    "email":"first.last@example.com"         }     }, }; $field_string = http_build_query($fields); curl_setopt($process, curlopt_postfields, $field_string); 

this gopay right?

do this:

$fields = [     "payer" => [         "default_payment_instrument" => "bank_account",         "allowed_payment_instruments" => ["bank_account"],         "default_swift" => "fiobczpp",         "contact" => [             "first_name" => "first",             "last_name" => "last",             "email" => "first.last@example.com"         ]     ] ];  $json = json_encode($fields);  curl_setopt($ch, curlopt_postfields, $json); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -