protected function _request($url, $xml, $scope = '') { WMXILogger::Append($xml); $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); if ($this->cainfo != '') { curl_setopt($ch, CURLOPT_CAINFO, $this->cainfo); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); } else { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); } $result = curl_exec($ch); if (curl_errno($ch) != 0) { $result = "<curl>\n"; $result .= "<errno>" . curl_errno($ch) . "</errno>\n"; $result .= "<error>" . curl_error($ch) . "</error>\n"; $result .= "</curl>\n"; $scope = 'cURL'; } curl_close($ch); WMXILogger::Append($result); return class_exists('WMXIResult') ? new WMXIResult($xml, $result, $scope) : $result; }
public function Sign($data) { if ($this->ekey == '' || $this->nkey == '') { die('Key is not loaded.'); } WMXILogger::Append('$ekey = ' . $this->ekey . ';'); WMXILogger::Append('$nkey = ' . $this->nkey . ';'); $result = ''; $plain = $this->_md4($data); for ($i = 0; $i < 10; ++$i) { $plain .= pack('V', $this->debug ? 0 : mt_rand()); } $plain = pack('v', $this->_strlen($plain)) . $plain; $m = $this->_hex2dec(bin2hex(strrev($plain))); WMXILogger::Append("\$m = {$m};"); $a = $this->_bcpowmod($m, $this->ekey, $this->nkey); WMXILogger::Append("\$a = {$a};"); $result = strtolower($this->_shortunswap($this->_dec2hex($a))); WMXILogger::Append("\$result = {$result};"); return $result; }