1

I am trying to get response from server using HTTP context:

$cparams = array(
        "ssl"=>array(
            "verify_peer"=>true,
            "verify_peer_name"=>true,
        ),
        'http' => $request['httpOptions']
    );

$context = stream_context_create($cparams);
$fp = fopen($request['url'], 'rb', false, $context);

But it showing

Error in exception handler: fopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

This is the URL:

$url = EZPAY_SERVER . "/hps/webservice/ezpay/CreateSessionKey";

ie,

https://psp.stg.transactium.com/hps/webservice/ezpay/CreateSessionKey?privateMerchantKey=********************

So i want to try it with Curl,

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Length: 0'));
    curl_setopt($ch, CURLOPT_URL,$request['url']);
    curl_setopt($ch, CURLOPT_POST, 1);

    // receive server response ...
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $server_output = curl_exec ($ch); 

    curl_close ($ch);

But now I'am getting this error.

A public action method 'CreateSessionKey' was not found on controller 'Transactium.HostedPayment.Controllers.EZPayController'. Notice: Trying to get property of non-object in /var/www/html/ezpay/library/EZPay.php on line 12

Geethu
  • 348
  • 6
  • 24
  • The second error is not related to curl, it is created from your application. Can you check if you have made some mistakes on your application? – Ben Dec 12 '17 at 11:41
  • @Ben I'am trying to intrgrate ezpay payment gateway.so initially a sesionkey is required as response from ezpay.there I'am getting this error.Ezpay controller is not in our application.So how can i check that? – Geethu Dec 13 '17 at 03:52
  • you should check their manual which parameters are required to request their gateway. – Ben Dec 13 '17 at 03:56
  • that i have mentioned in the question. The first code using http context – Geethu Dec 13 '17 at 03:57
  • related link: https://stackoverflow.com/questions/2138527/php-curl-http-post-sample-code – Ben Dec 13 '17 at 04:05
  • yeah I'am following that.For this request, the only one parameter to be sent is the merchant key and it is already included in the url.so i think no need to include other parameters in the curl( as mentioned in the http context method($cparams)). I tried that also. but the same error. – Geethu Dec 13 '17 at 04:10
  • can you update the post to include the updated code? – Ben Dec 13 '17 at 04:14
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/161075/discussion-between-shalom-and-ben). – Geethu Dec 13 '17 at 04:24

0 Answers0