当前位置: 首页>>代码示例>>PHP>>正文


PHP DomDocument::getElementsbyTagName方法代码示例

本文整理汇总了PHP中DomDocument::getElementsbyTagName方法的典型用法代码示例。如果您正苦于以下问题:PHP DomDocument::getElementsbyTagName方法的具体用法?PHP DomDocument::getElementsbyTagName怎么用?PHP DomDocument::getElementsbyTagName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DomDocument的用法示例。


在下文中一共展示了DomDocument::getElementsbyTagName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: login

 /**
  * Logs into Windows Live
  *
  * @return true on success else error
  */
 public function login()
 {
     // Register device
     $register = $this->registerDevice();
     // Get binary DA token
     $response = $this->getBinaryDAToken($this->messageid, $this->deviceUserName, $this->devicePassword);
     $responsedom = new DomDocument();
     $responsedom->loadXML($response);
     $cipherValues = $responsedom->getElementsbyTagName("CipherValue");
     $this->cipherValue = $cipherValues->item(0)->textContent;
     if (!empty($this->cipherValue)) {
         // Get security tokens
         $response = $this->getSecurityTokens($this->cipherValue);
         $responsedom = new DomDocument();
         $responsedom->loadXML($response);
         $cipherValues = $responsedom->getElementsbyTagName("CipherValue");
         $this->securityToken0 = $cipherValues->item(0)->textContent;
         $this->securityToken1 = $cipherValues->item(1)->textContent;
         $this->keyIdentifier = $responsedom->getElementsbyTagName("KeyIdentifier")->item(0)->textContent;
         if (empty($this->keyIdentifier) || empty($this->securityToken0) || empty($this->securityToken1)) {
             $this->_error = "Failed to get security tokens.";
         } else {
             return true;
         }
     } else {
         $this->_error = "Failed to get binary DA token.";
     }
 }
开发者ID:ali-sharifi,项目名称:CRMPHP,代码行数:33,代码来源:dynamicsclient.php

示例2: AuthenticateUser

 public function AuthenticateUser()
 {
     $SOAPresult = GetSOAPResponse('https://login.microsoftonline.com/RST2.srf', $this->BuildOCPSoap());
     $responsedom = new DomDocument();
     $responsedom->loadXML($SOAPresult);
     $cipherValues = $responsedom->getElementsbyTagName("CipherValue");
     if (isset($cipherValues) && $cipherValues->length > 0) {
         $this->securityToken0 = $cipherValues->item(0)->textContent;
         $this->securityToken1 = $cipherValues->item(1)->textContent;
         $this->keyIdentifier = $responsedom->getElementsbyTagName("KeyIdentifier")->item(0)->textContent;
     } else {
         return null;
     }
 }
开发者ID:kgatjens,项目名称:crm-php,代码行数:14,代码来源:authentication.php

示例3: CrmGetUserName

function CrmGetUserName($authHeader, $id, $url)
{
    $xml = "<s:Body>";
    $xml .= "<Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";
    $xml .= "<request i:type=\"a:RetrieveRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">";
    $xml .= "<a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";
    $xml .= "<a:KeyValuePairOfstringanyType>";
    $xml .= "<b:key>Target</b:key>";
    $xml .= "<b:value i:type=\"a:EntityReference\">";
    $xml .= "<a:Id>" . $id . "</a:Id>";
    $xml .= "<a:LogicalName>systemuser</a:LogicalName>";
    $xml .= "<a:Name i:nil=\"true\" />";
    $xml .= "</b:value>";
    $xml .= "</a:KeyValuePairOfstringanyType>";
    $xml .= "<a:KeyValuePairOfstringanyType>";
    $xml .= "<b:key>ColumnSet</b:key>";
    $xml .= "<b:value i:type=\"a:ColumnSet\">";
    $xml .= "<a:AllColumns>false</a:AllColumns>";
    $xml .= "<a:Columns xmlns:c=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">";
    $xml .= "<c:string>firstname</c:string>";
    $xml .= "<c:string>lastname</c:string>";
    $xml .= "</a:Columns>";
    $xml .= "</b:value>";
    $xml .= "</a:KeyValuePairOfstringanyType>";
    $xml .= "</a:Parameters>";
    $xml .= "<a:RequestId i:nil=\"true\" />";
    $xml .= "<a:RequestName>Retrieve</a:RequestName>";
    $xml .= "</request>";
    $xml .= "</Execute>";
    $xml .= "</s:Body>";
    $executeSoap = new CrmExecuteSoap();
    $response = $executeSoap->ExecuteSOAPRequest($authHeader, $xml, $url);
    $responsedom = new DomDocument();
    $responsedom->loadXML($response);
    $firstname = "";
    $lastname = "";
    $values = $responsedom->getElementsbyTagName("KeyValuePairOfstringanyType");
    foreach ($values as $value) {
        if ($value->firstChild->textContent == "firstname") {
            $firstname = $value->lastChild->textContent;
        }
        if ($value->firstChild->textContent == "lastname") {
            $lastname = $value->lastChild->textContent;
        }
    }
    return $firstname . " " . $lastname;
}
开发者ID:dyuhasinventhelp,项目名称:CRMSoapAuthPHP,代码行数:47,代码来源:index.php

示例4: getAccount


//.........这里部分代码省略.........
    $xml .= '                   <a:AttributeName>emailaddress1</a:AttributeName>';
    $xml .= '                    <a:Operator>Equal</a:Operator>';
    $xml .= '                    <a:Values xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/Arrays">';
    $xml .= '                      <c:anyType i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">someone_a@example.com</c:anyType>';
    $xml .= '                    </a:Values>';
    $xml .= '                  </a:ConditionExpression>';
    $xml .= '                </a:Conditions>';
    $xml .= '                <a:FilterOperator>And</a:FilterOperator>';
    $xml .= '                <a:Filters />';
    $xml .= '                <a:IsQuickFindFilter>false</a:IsQuickFindFilter>';
    $xml .= '              </a:Criteria>';
    $xml .= '              <a:Distinct>false</a:Distinct>';
    $xml .= '              <a:EntityName>contact</a:EntityName>';
    $xml .= '              <a:LinkEntities />';
    $xml .= '              <a:Orders />';
    $xml .= '              <a:PageInfo>';
    $xml .= '                <a:Count>0</a:Count>';
    $xml .= '                <a:PageNumber>0</a:PageNumber>';
    $xml .= '                <a:PagingCookie i:nil="true" />';
    $xml .= '                <a:ReturnTotalRecordCount>false</a:ReturnTotalRecordCount>';
    $xml .= '              </a:PageInfo>';
    $xml .= '              <a:NoLock>false</a:NoLock>';
    $xml .= '            </b:value>';
    $xml .= '          </a:KeyValuePairOfstringanyType>';
    $xml .= '        </a:Parameters>';
    $xml .= '        <a:RequestId i:nil="true" />';
    $xml .= '        <a:RequestName>RetrieveMultiple</a:RequestName>';
    $xml .= '      </request>';
    $xml .= '    </Execute>';
    $xml .= '  </s:Body>';
    // $xml = '<s:Body>';
    // $xml .= '    <Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">';
    // $xml .= '      <request i:type=\"a:RetrieveMultipleRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">';
    // $xml .= '        <a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">';
    // $xml .= '          <a:KeyValuePairOfstringanyType>';
    // $xml .= '            <b:key>Target</b:key>';
    // $xml .= '            <b:value i:type=\"a:EntityReference\">';
    // $xml .= "<a:Name i:nil=\"true\" />";
    // $xml .= '            </b:value>';
    // $xml .= '          </a:KeyValuePairOfstringanyType>';
    // $xml .= "<a:KeyValuePairOfstringanyType>";
    // $xml .= "<b:key>ColumnSet</b:key>";
    // 	$xml .= "<b:value i:type=\"a:ColumnSet\">";
    // $xml .= '                <a:AllColumns>false</a:AllColumns>';
    // $xml .= '                <a:Columns xmlns:c=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">';
    // $xml .= '                  <c:string>firstname</c:string>';
    // $xml .= '                </a:Columns>';
    // $xml .= '              </a:ColumnSet>';
    // $xml .= '              <a:EntityName>contact</a:EntityName>';
    // 	$xml .= "</b:value>";
    // 	$xml .= "</a:KeyValuePairOfstringanyType>";
    // $xml .= '        </a:Parameters>';
    // $xml .= '        <a:RequestId i:nil="true" />';
    // $xml .= '        <a:RequestName>RetrieveMultiple</a:RequestName>';
    // $xml .= '      </request>';
    // $xml .= '    </Execute>';
    // $xml .= '  </s:Body>';
    // $xml = "<s:Body>";
    // 	$xml .= "<Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";
    // 	$xml .= "<request i:type=\"a:RetrieveRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">";
    // 	$xml .= "<a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";
    // 	$xml .= "<a:KeyValuePairOfstringanyType>";
    // 	$xml .= "<b:key>Target</b:key>";
    // 	$xml .= "<b:value i:type=\"a:EntityReference\">";
    // 	$xml .= "<a:Id>" . $id . "</a:Id>";
    // 	$xml .= "<a:LogicalName>systemuser</a:LogicalName>";
    // 	$xml .= "<a:Name i:nil=\"true\" />";
    // 	$xml .= "</b:value>";
    // 	$xml .= "</a:KeyValuePairOfstringanyType>";
    // 	$xml .= "<a:KeyValuePairOfstringanyType>";
    // 	$xml .= "<b:key>ColumnSet</b:key>";
    // 	$xml .= "<b:value i:type=\"a:ColumnSet\">";
    // 	$xml .= "<a:AllColumns>false</a:AllColumns>";
    // 	$xml .= "<a:Columns xmlns:c=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">";
    // 	$xml .= "<c:string>firstname</c:string>";
    // 	$xml .= "<c:string>lastname</c:string>";
    // 	$xml .= "</a:Columns>";
    // 	$xml .= "</b:value>";
    // 	$xml .= "</a:KeyValuePairOfstringanyType>";
    // 	$xml .= "</a:Parameters>";
    // 	$xml .= "<a:RequestId i:nil=\"true\" />";
    // 	$xml .= "<a:RequestName>Retrieve</a:RequestName>";
    // 	$xml .= "</request>";
    // 	$xml .= "</Execute>";
    // 	$xml .= "</s:Body>";
    $executeSoap = new CrmExecuteSoap();
    $response = $executeSoap->ExecuteSOAPRequest($authHeader, $xml, $url);
    $responsedom = new DomDocument();
    $responsedom->loadXML($response);
    $values = $responsedom->getElementsbyTagName("KeyValuePairOfstringanyType");
    foreach ($values as $value) {
        if ($value->firstChild->textContent == "firstname") {
            $firstname = $value->lastChild->textContent;
        }
        if ($value->firstChild->textContent == "lastname") {
            $lastname = $value->lastChild->textContent;
        }
    }
    return $firstname . " " . $lastname;
}
开发者ID:kgatjens,项目名称:crm-php,代码行数:101,代码来源:index.php

示例5: readOrg

    public function readOrg($accountId, $CRMURL, $securityData)
    {
        $domainname = substr($CRMURL, 8, -1);
        $pos = strpos($domainname, "/");
        $domainname = substr($domainname, 0, $pos);
        $accountsRequest = EntityUtils::getCRMSoapHeader($CRMURL, $securityData) . '
              <s:Body>
                    <Execute xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
                            <request i:type="b:RetrieveMultipleRequest" xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                                    <b:Parameters xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
                                            <b:KeyValuePairOfstringanyType>
                                                    <c:key>Query</c:key>
                                                    <c:value i:type="b:FetchExpression">
                                                            <b:Query>&lt;fetch mapping="logical" count="50" version="1.0"&gt;&#xD;
                                                                    &lt;entity name="account"&gt;&#xD;
                                                                    &lt;attribute name="name" /&gt;&#xD;
                                                                    &lt;attribute name="address1_city" /&gt;&#xD;
                                                                    &lt;attribute name="telephone1" /&gt;&#xD;
                                                                    &lt;filter type="and"&gt;
                                                                        &lt;condition attribute="accountid" operator="eq" value="' . $accountId . '" /&gt;
                                                                    &lt;/filter&gt;
                                                                    &lt;/entity&gt;&#xD;
                                                                    &lt;/fetch&gt;
                                                            </b:Query>
                                                    </c:value>
                                            </b:KeyValuePairOfstringanyType>
                                    </b:Parameters>
                                    <b:RequestId i:nil="true"/><b:RequestName>RetrieveMultiple</b:RequestName>
                            </request>
                    </Execute>
                    </s:Body>
            </s:Envelope>
			';
        $response = LiveIDManager::GetSOAPResponse("/Organization.svc", $domainname, $CRMURL, $accountsRequest);
        $accountsArray = array();
        if ($response != null && $response != "") {
            $responsedom = new DomDocument();
            $responsedom->loadXML($response);
            $entities = $responsedom->getElementsbyTagName("Entity");
            foreach ($entities as $entity) {
                $account = array();
                $kvptypes = $entity->getElementsbyTagName("KeyValuePairOfstringanyType");
                foreach ($kvptypes as $kvp) {
                    $key = $kvp->getElementsbyTagName("key")->item(0)->textContent;
                    $value = $kvp->getElementsbyTagName("value")->item(0)->textContent;
                    if ($key == 'accountid') {
                        $account['accountId'] = $value;
                    }
                    if ($key == 'name') {
                        $account['name'] = $value;
                    }
                    if ($key == 'telephone1') {
                        $account['telephone'] = $value;
                    }
                    if ($key == 'address1_city') {
                        $account['address'] = $value;
                    }
                }
                $accountsArray[] = $account;
            }
        }
        return $accountsArray;
    }
开发者ID:jhogan,项目名称:MsDynamicsPHP,代码行数:63,代码来源:CrmAPIContext.php

示例6: GetADFS

 /**
  * Gets the name of the AD FS server CRM uses for authentication.
  * 
  * @return String The AD FS server url.
  * @param String $url
  *        	The Url of the CRM On Premise (IFD) organization (https://org.domain.com).
  */
 function GetADFS($url)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url . "XrmServices/2011/Organization.svc?wsdl=wsdl0");
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, 60);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     $response = curl_exec($ch);
     curl_close($ch);
     $responsedom = new DomDocument();
     $responsedom->loadXML($response);
     $identifiers = $responsedom->getElementsbyTagName("Identifier");
     $identifier = $identifiers->item(0)->textContent;
     return str_replace("http://", "https://", $identifier);
 }
开发者ID:dyuhasinventhelp,项目名称:CRMSoapAuthPHP,代码行数:22,代码来源:CrmAuth.php

示例7: writeGPXfile

/**
 * Writes data into an GPX-file.
 * @param $bAppend
 * true: appends data into existing file
 * false: creates a new file
 * @param $aFile
 * the name of the xml-file
 * @param $aLatitude
 * a latitude-value
 * @param $aLongitude
 * a longitude-value
 * @param $aSpeed
 * a speed-value
 * @param $anAltitude
 * an altitude-value
 * @param $aDirection
 * a direction-value
 */
function writeGPXfile($bAppend, $aFile, $csvLines)
{
    $doc = new DomDocument("1.0", "UTF-8");
    if (!$doc) {
        echo "error creating dom document";
        return false;
    }
    if ($bAppend == true) {
        // we want to append to existing data in a file
        // check before, if it exists!
        if (file_exists($aFile)) {
            $doc->load($aFile);
        }
    }
    // make the XML-file human-readable
    $doc->preserveWhiteSpace = false;
    $doc->formatOutput = true;
    // check, if we got a root element
    if (!$doc->documentElement) {
        $root = $doc->createElement("gpx");
        if (!$root) {
            echo "error fetching root";
            return false;
        }
        $doc->appendChild($root);
    } else {
        $root = $doc->documentElement;
    }
    // adding some attributes for the root
    $root->setAttribute('xmlns', "http://www.topografix.com/GPX/1/1");
    $root->setAttribute('creator', "geo5");
    $root->setAttribute('version', "1.1");
    $root->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance");
    $root->setAttribute('xsi:schemaLocation', "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd");
    $myTempTime = getdate();
    $myMonth = $myTempTime['mon'];
    if ($myMonth < 10) {
        $myMonth = "0" . $myMonth;
    }
    $myDays = $myTempTime['mday'];
    if ($myDays < 10) {
        $myDays = "0" . $myDays;
    }
    $myHours = $myTempTime['hours'];
    if ($myHours < 10) {
        $myHours = "0" . $myHours;
    }
    $myMinutes = $myTempTime['minutes'];
    if ($myMinutes < 10) {
        $myMinutes = "0" . $myMinutes;
    }
    $mySeconds = $myTempTime['seconds'];
    if ($mySeconds < 10) {
        $mySeconds = "0" . $mySeconds;
    }
    $myTime = $myTempTime['year'] . "-" . $myMonth . "-" . $myDays . "T" . $myHours . ":" . $myMinutes . ":" . $mySeconds . ".000Z+1:00";
    // create trk-element, if not already there
    $trksegelement = $doc->getElementsbyTagName('trkseg')->item(0);
    if (!$trksegelement) {
        $trkelement = $doc->createElement('trk');
        $root->appendChild($trkelement);
        $trksubElement = $doc->createElement('name', 'geo5-' . substr($myTime, 0, 10));
        $trkelement->appendChild($trksubElement);
        // create a trkseg-element
        $trksegelement = $doc->createElement('trkseg');
        $trkelement->appendChild($trksegelement);
    }
    if ($csvLines != '') {
        $lines = explode(PHP_EOL, $csvLines);
        $count = count($lines);
        for ($i = 0; $i < $count; $i++) {
            $line = $lines[$i];
            // now create a new track-point in between the track-segment
            $element = $doc->createElement("trkpt");
            if (!$element) {
                logMessage("error creating element");
            }
            $searchString = '/lat=(.*?);/i';
            if (preg_match($searchString, $line, $matches)) {
                $element->setAttribute('lat', $matches[1]);
            } else {
                logMessage("Did not find 'lat' while writing gpx for csv line {$line}.");
//.........这里部分代码省略.........
开发者ID:einervonvielen,项目名称:mushrooms,代码行数:101,代码来源:util.php

示例8: authenticateWithLiveID


//.........这里部分代码省略.........
                     </o:UsernameToken>
                 </o:Security>
                 </s:Header>
                <s:Body>
                <t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
                     <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
                     <a:EndpointReference>
                         <a:Address>http://passport.net/tb</a:Address>
                     </a:EndpointReference>
                     </wsp:AppliesTo>
                     <t:RequestType>
                     http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
                 </t:RequestSecurityToken>
                 </s:Body>
             </s:Envelope>';
     $soapTemplate = sprintf($deviceCredentialsSoapTemplate, LiveIDManager::gen_uuid(), LiveIDManager::getCurrentTime(), LiveIDManager::getNextDayTime(), $deviceCredentials->getDeviceName(), $deviceCredentials->getPassword());
     $binaryDATokenXML = LiveIDManager::GetSOAPResponse("/liveidSTS.srf", "login.live.com", "https://login.live.com/liveidSTS.srf", $soapTemplate);
     preg_match('/<CipherValue>(.*)<\\/CipherValue>/', $binaryDATokenXML, $matches);
     $cipherValue = $matches[1];
     // Step 3: Get Security Token by sending WLID username, password and device binaryDAToken
     $securityTokenSoapTemplate = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
              xmlns:a="http://www.w3.org/2005/08/addressing"
              xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
             <s:Header>
                 <a:Action s:mustUnderstand="1">
                 http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
                 <a:MessageID>urn:uuid:%s</a:MessageID>
                 <a:ReplyTo>
                   <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
                 </a:ReplyTo>
                 <VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">
                 uIDPozBEz+P/wJdOhoN2XNauvYcAAAAAK0Y6fOjvMEqbgs9ivCmFPaZlxcAnCJ1GiX+Rpi09nSYACQAA</VsDebuggerCausalityData>
                 <a:To s:mustUnderstand="1">
                 https://login.microsoftonline.com/extSTS.srf</a:To>
                 <o:Security s:mustUnderstand="1"
                 xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                   <u:Timestamp u:Id="_0">
                    <u:Created>%s</u:Created>
                    <u:Expires>%s</u:Expires>
                   </u:Timestamp>
                   <o:UsernameToken u:Id="user">
                     <o:Username>%s</o:Username>
                     <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">%s</o:Password>
                   </o:UsernameToken>
                   <wsse:BinarySecurityToken ValueType="urn:liveid:device"
                   xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                     <EncryptedData Id="BinaryDAToken0"
                     Type="http://www.w3.org/2001/04/xmlenc#Element"
                     xmlns="http://www.w3.org/2001/04/xmlenc#">
                       <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc">
                       </EncryptionMethod>
                       <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
                         <ds:KeyName>http://Passport.NET/STS</ds:KeyName>
                       </ds:KeyInfo>
                       <CipherData>
                         <CipherValue>
                           %s"
                         </CipherValue>
                       </CipherData>
                     </EncryptedData>
                   </wsse:BinarySecurityToken>
                 </o:Security>
              </s:Header>
               <s:Body>
                 <t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
                   <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
                     <a:EndpointReference>
                       <a:Address>%s</a:Address>
                     </a:EndpointReference>
                   </wsp:AppliesTo>
                  <wsp:PolicyReference URI="MBI_FED_SSL"
                   xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" />
                   <t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
                 </t:RequestSecurityToken>
               </s:Body>
              </s:Envelope>';
     // Create the URN address of the format urn:crm:dynamics.com.
     // Replace crm with crm4 for Europe & crm5 for Asia.
     $URNAddress = "urn:crmemea:dynamics.com";
     if (strpos($CRMUrl, "crm4.dynamics.com")) {
         $URNAddress = "urn:crmemea:dynamics.com";
     }
     if (strpos($CRMUrl, "crm5.dynamics.com")) {
         $URNAddress = "urn:crmapac:dynamics.com";
     }
     $securityTemplate = sprintf($securityTokenSoapTemplate, LiveIDManager::gen_uuid(), LiveIDManager::getCurrentTime(), LiveIDManager::getNextDayTime(), $liveIDUsername, $liveIDPassword, $cipherValue, $URNAddress);
     $securityTokenXML = LiveIDManager::GetSOAPResponse("/extSTS.srf", "login.microsoftonline.com", "https://login.microsoftonline.com/extSTS.srf", $securityTemplate);
     $responsedom = new DomDocument();
     $responsedom->loadXML($securityTokenXML);
     $cipherValues = $responsedom->getElementsbyTagName("CipherValue");
     if (isset($cipherValues) && $cipherValues->length > 0) {
         $securityToken0 = $cipherValues->item(0)->textContent;
         $securityToken1 = $cipherValues->item(1)->textContent;
         $keyIdentifier = $responsedom->getElementsbyTagName("KeyIdentifier")->item(0)->textContent;
     } else {
         return null;
     }
     $newSecurityData = new SecurityData($keyIdentifier, $securityToken0, $securityToken1);
     return $newSecurityData;
 }
开发者ID:kgatjens,项目名称:crm-php,代码行数:101,代码来源:LiveIDManager.php


注:本文中的DomDocument::getElementsbyTagName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。