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
Post a Comment