0

We're using a new payment gateway, if HTTP status code is 200, it means a successful transaction. We process hundreds of thousands of requests each day, around 10 requests aren't detected as successful from our side.

<?php
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
@curl_setopt($ch, CURLOPT_URL, $URL);
@curl_setopt($ch, CURLOPT_VERBOSE, 1);
@curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
@curl_setopt($ch, CURLOPT_POST, 1);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@curl_setopt($ch, CURLOPT_HEADER, 1);
@curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Content-Type: application/xml;charset=UTF-8"
));
@curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
@curl_setopt($ch, CURLOPT_TIMEOUT, 60);

@curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);

if (@curl_errno($ch)) {
    curl_close($ch);
    return -11;
} else {
    $response = @curl_exec($ch);
    $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
    $header = substr($response, 0, $header_size);
    $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    if ($status_code == 200) {
        echo "ok";
    }
}

I'm logging everything, I removed the logs for the purpose of this question. The payment gateway returns 200, the customer is charged, I know that because I'm working closely with the team in charge of the gateway.

From our side, no curl timeout error, we can log the response successfully to a file, the response and $status_code are null/empty. why?

Lynob
  • 4,069
  • 12
  • 47
  • 98

0 Answers0