saad saad - 3 months ago 88
reST (reStructuredText) Question

Payfort REST POST request using JSON

Working on the payfort payment api
I have got a problem with REST POST request using JSON after tokinization is performed. my code is

$service_url = '';
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestParams);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($requestParams)));
$curl_response = curl_exec($curl);

$curl_response is always false

enter image description here


This one give the result

        $requestParams['signature'] = $signature;

        $result = file_get_contents('', null, stream_context_create(array(
                'http' => array(
                'method' => 'POST',
                'header' => 'Content-Type: application/json' . "\r\n"
                . 'Content-Length: ' . strlen($requestParams) . "\r\n",
                'content' => $requestParams,