Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

monyancha's avatar

Failed to connect to qosic.net port 8443: Connection refused Curl Api Request

Am having an issue testing an api for Benin payments using curl but am getting an error when am testing it on live server but it works fine when its on localhost.

This is the error: Failed to connect to qosic.net port 8443: Connection refused

This is the api provider: https://qosic.com/ https://qosic.com/docs/api/payment

Kindly help me figure out the issue.

And here my curl request code:

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://qosic.net:8443/QosicBridge/user/requestpayment',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "msisdn": "22961841744",
    "amount": "350",
    "firstname":"David",
    "lastname":"Ashaolu",
    "transref" :"74715",
    "clientid": "HUBSTARBPH"
}',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Content-Type: application/json',
    'Authorization: Basic UVNVU1I2OTg6YU1Kcm5mWnByMFdrcThwQ0ZjQ2s='
  ),
));

$response = curl_exec($curl);


if(curl_errno($curl)){
    echo 'Request Error: ' . curl_error($curl);
}

curl_close($curl);


echo $response;

0 likes
0 replies

Please or to participate in this conversation.