loadXML($xmltext);
$array_e = $xml->getElementsByTagName('Encrypt');
$encrypt = $array_e->item(0)->nodeValue;
return array(0, $encrypt);
} catch (Exception $e) {
print $e . "\n";
return array(ErrorCode::$ParseXmlError, null);
}
}
/**
* 生成xml消息
* @param string $encrypt 加密后的消息密文
* @param string $signature 安全签名
* @param string $timestamp 时间戳
* @param string $nonce 随机字符串
*/
public function generate($encrypt, $signature, $timestamp, $nonce)
{
$format = "
%s
";
return sprintf($format, $encrypt, $signature, $timestamp, $nonce);
}
}
//
// Test
/*
$sPostData = "";
$xmlparse = new XMLParse;
$array = $xmlparse->extract($sPostData);
var_dump($array);
*/
?>