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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -