Internal Server Error 500


Internal Server Error 500

HI @Panamera  and @swaritsharma,


Below is the sample curl I am using to call the endpoint.


The below code was extracted from the sample code provided in the project.


$username = '........';
$password = '.........';
$url = '';

$postData = json_decode('', true);

$curl = curl_init();
// set timeout, if needed
curl_setopt($curl, CURLOPT_TIMEOUT, 0);
// set connect timeout, if needed
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);

// return the result on success, rather than just true
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
"Accept" => "application/json",
"Authorization" => "Basic " . base64_encode( $username. ":" .$password),
// "x-pay-token" => getXpayToken($postData, $url, null, $password)

// disable SSL verification, if needed
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
//curl_setopt($curl, CURLOPT_PROXY, '');
//curl_setopt($curl, CURLOPT_PROXYPORT, '');
curl_setopt($curl, CURLOPT_SSLCERT, getcwd().'/rsa/keys/cert.pem');
curl_setopt($curl, CURLOPT_SSLKEY, getcwd().'/rsa/keys/key_42xxxxxxxx.pem'); //$this->config->getPrivateKey());
curl_setopt($curl, CURLOPT_CAINFO, getcwd().'/rsa/keys/DigiCertGlobalRootCA.crt'); //$this->config->getCaCertPath());
// curl_setopt($curl, CURLOPT_CAINFO, getcwd().'/rsa/keys/VDPCA-SBX.pem');
//curl_setopt($curl, CURLOPT_PROXYTYPE, '');
//curl_setopt($curl, CURLOPT_PROXYUSERPWD, $username.":".$password);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");

curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");

curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($postData));
curl_setopt($curl, CURLOPT_URL, $url);

// Set user agent
//curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent());
curl_setopt($curl, CURLOPT_VERBOSE, 0);

// obtain the HTTP response headers
curl_setopt($curl, CURLOPT_HEADER, 1);

// Make the request
$response = curl_exec($curl);


Please, kindly reply as I have been on this issue going to 3 weeks now.


I look forward to your quick response.


Thank you

Occasional Visitor

Re: Internal Server Error 500

It appears that you are trying to make an API call to enroll a user in a Visa program using CURL in PHP. Based on the code provided, it appears that you have set various options for the CURL request such as timeout, connect timeout, return transfer, HTTP headers, SSL verification, SSL certificates, and HTTP basic authentication.

However, the $postData variable is empty, and you are not handling any errors or exceptions that may occur during the CURL request. I recommend adding a check for the response to determine whether the request was successful, and handling any errors if necessary.

Here's an example of how you can handle the CURL response:

$response = curl_exec($curl);

if (curl_errno($curl)) {
    $errorMessage = curl_error($curl);
    // handle error
} else {
    $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
    $header = substr($response, 0, $headerSize);
    $body = substr($response, $headerSize);
    // process response


I hope this helps. Let me know if you have any further questions.