mercredi 4 septembre 2019

How to use a form action to a URL post request in a generic Controller for Laravel?

Basically, I have this piece of code here given to me by a third party integration platform;

 <form action="https://yoururlhere.php" method="post"> 

Is it possible to do this post request in a Controller for Laravel? I'm trying to fiddle with Guzzle now, but I am uncertain of how to send my post request to that specific API. This is what I have right now;

$client = new Client();
        $URI = 'https://yoururlhere.php';
        $params['headers'] = ['Content-Type' => 'application/json', 'Authorization' => $key];
        $params['form_params'] = array('ord_date' => $dueDate, 'ord_totalamt' => $cart_total, 'ord_gstamt' => 0.00, 'ord_shipname' => $user['name'], 'ord_mercref' => $ord_mercref,
                                        'ord_mercID' => $merchantid, 'ord_returnURL' => $url, 'merchant_hashvalue' => $key);
        $response = $client->post($URI, $params);

But this is not correct. Any help would be appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire