Вход Регистрация
Файл: 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($fpCURLOPT_URL"https://www.portmone.com.ua/secure/bills/results.php");
        
curl_setopt($fpCURL_HTTP_VERSION_1_01);
        
curl_setopt($fpCURLOPT_POST1);
        
curl_setopt($fpCURLOPT_POSTFIELDS$post_data);
        
curl_setopt($fpCURLOPT_SSL_VERIFYPEER0);
        
curl_setopt($fpCURLOPT_SSL_VERIFYHOST0);
        
curl_setopt($fpCURLOPT_RETURNTRANSFER,1);
        
curl_setopt($fpCURLOPT_TIMEOUT120);

        
$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;
        }

    }

}
?>
Онлайн: 2
Реклама