本文整理汇总了PHP中DomDocument::createTextnode方法的典型用法代码示例。如果您正苦于以下问题:PHP DomDocument::createTextnode方法的具体用法?PHP DomDocument::createTextnode怎么用?PHP DomDocument::createTextnode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomDocument
的用法示例。
在下文中一共展示了DomDocument::createTextnode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DomDocument
function __doRequest($request, $location, $action, $version)
{
$dom = new DomDocument('1.0', 'UTF-8');
$dom->preserveWhiteSpace = false;
$dom->loadXML($request);
$hdr = $dom->createElement('soapenv:Header');
$secNode = $dom->createElement("wsse:Security");
$secNode->setAttribute("soapenv:mustUnderstand", "1");
$secNode->setAttribute("xmlns:wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
$usernameTokenNode = $dom->createElement("wsse:UsernameToken");
$usernameTokenNode->setAttribute("wsu:Id", "UsernameToken-1");
$usernameTokenNode->setAttribute("xmlns:wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
$usrNode = $dom->createElement("wsse:Username");
$usrNode->appendChild($dom->createTextNode(WS_USER));
$pwdNode = $dom->createElement("wsse:Password");
$pwdNode->setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
$pwdNode->appendchild($dom->createTextnode(WS_PWD));
$usernameTokenNode->appendChild($usrNode);
$usernameTokenNode->appendChild($pwdNode);
$secNode->appendChild($usernameTokenNode);
$hdr->appendChild($secNode);
$dom->documentElement->insertBefore($hdr, $dom->documentElement->firstChild);
$request = $dom->saveXML();
$request = str_replace("SOAP-ENV", "soapenv", $request);
$request = str_replace("ns1", "cgt", $request);
$request = str_replace('<?xml version="1.0" encoding="UTF-8"?>', '', $request);
// echo "Este es el nuevo XML: " . print_r($request, true);
return parent::__doRequest($request, $location, $action, $version);
}