Skip to content

Instantly share code, notes, and snippets.

@otarza
Created December 27, 2017 18:18
Show Gist options
  • Save otarza/178f20d986b006687b749bffb41e4ff9 to your computer and use it in GitHub Desktop.
Save otarza/178f20d986b006687b749bffb41e4ff9 to your computer and use it in GitHub Desktop.
TBC Payment
<?php
/**
* Curl is responsible for sending data to remote server, using certificate for ssl connection
* @param string $query_string created from an array using method build_query_string
* @return string returns tbc server response in the form of key: value \n key: value. OR error: value.
*/
private function curl($query_string)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_POSTFIELDS, $query_string);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_CAINFO, $this->cert_path); // because of Self-Signed certificate at payment server.
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSLCERT, '/home/donatest.girchi.ge/certs/bibliuri.pem');
curl_setopt($curl, CURLOPT_SSLKEY,'/home/donatest.girchi.ge/certs/bibliuri.key' );
//curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $this->cert_pass);
curl_setopt($curl, CURLOPT_URL, $this->submit_url);
print $query_string;
$result = curl_exec($curl);
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment