Файл: billing/_rootinc/portmone.inc.php
Строк: 31
<?
class PORTMONE
{
public $controller = true;
public $shopid = null;
public $user = null;
public $password = null;
public $error = null;
public function startup(&$controller)
{
$this->controller =& $controller;
}
public function init($shopid, $user, $password)
{
$this->shopid=$shopid;
$this->user=$user;
$this->password=$password;
}
public function connect($post_data)
{
$fp = curl_init();
curl_setopt($fp, CURLOPT_URL, "https://www.portmone.com.ua/secure/bills/results.php");
curl_setopt($fp, CURL_HTTP_VERSION_1_0, 1);
curl_setopt($fp, CURLOPT_POST, 1);
curl_setopt($fp, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($fp, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($fp, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($fp, CURLOPT_RETURNTRANSFER,1);
curl_setopt($fp, CURLOPT_TIMEOUT, 120);
$result = curl_exec($fp);
curl_close($fp);
return $result;
}
public function checkBill($orderid)
{
$xmlstr = $this->connect("SHOPORDERNUMBER=$orderid&SHOP_ID=".$this->shopid."&LOG=".$this->user."&PASS=".$this->password);
if ($xmlstr == '') {
$this->error='checkBill: No output';
return false;
}
$xmlArray = toarray($xmlstr,"portmoneresult",1);
if ($xmlArray[error_code][0][value] == "0") {
return $xmlArray[total][0][value];
} else {
if ($xmlArray[error_code][0][value]) {
$xmlArray[error_message][0][value]=iconv("windows-1251", "utf-8", $xmlArray[error_message][0][value]);
$this->error = "code ".$xmlArray[error_code][0][value].", ".$xmlArray[error_message][0][value];
}
return false;
}
}
}
?>