src/Google/AdsApi/Common/Util/SoapHeaders.php
public static function getSoapHeaderValue($xml, $soapHeaderName)
    {
        $headerValue = '';

        if ($xml === null || $xml === '') {
            return $headerValue;
        }

        $xmlReader = new XMLReader();
        $xmlReader->xml($xml);
        while ($xmlReader->read()) {
            if ($xmlReader->nodeType === XMLReader::ELEMENT
                && $xmlReader->localName === $soapHeaderName) {
                $xmlReader->read();
                $headerValue = $xmlReader->value;
            } elseif ($xmlReader->nodeType === XMLReader::END_ELEMENT
                && $xmlReader->localName === self::$SOAP_HEADER_NODE_NAME) {
                break;
            }
        }
        $xmlReader->close();

        return $headerValue;
    }
public static function getSoapHeaderValue($xml, $soapHeaderName)
    {
        $headerValue = '';

        if ($xml === null || $xml === '') {
            return $headerValue;
        }

        $xmlReader = new XMLReader();
        $xmlReader->xml($xml);
        while ($xmlReader->read()) {
            if ($xmlReader->nodeType === XMLReader::ELEMENT
                && $xmlReader->localName === $soapHeaderName) {
                $xmlReader->read();
                $headerValue = $xmlReader->value;
            } elseif ($xmlReader->nodeType === XMLReader::END_ELEMENT
                && $xmlReader->localName === self::$SOAP_HEADER_NODE_NAME) {
                break;
            }
        }
        $xmlReader->close();

        return $headerValue;
    }
public static function getSoapHeaderValue ( $ xml , $ soapHeaderName ) { $ headerValue = '' ; if ( $ xml === null || $ xml === '' ) { return $ headerValue ; } $ xmlReader = new XMLReader ( ) ; $ xmlReader -> xml ( $ xml ) ; while ( $ xmlReader -> read ( ) ) { if ( $ xmlReader -> nodeType === XMLReader :: ELEMENT && $ xmlReader -> localName === $ soapHeaderName ) { $ xmlReader -> read ( ) ; $ headerValue = $ xmlReader -> value ; } elseif ( $ xmlReader -> nodeType === XMLReader :: END_ELEMENT && $ xmlReader -> localName === self :: $ SOAP_HEADER_NODE_NAME ) { break ; } } $ xmlReader -> close ( ) ; return $ headerValue ; }
Gets the value of the specified SOAP header from the specified SOAP request
or response payload as an XML string.

@param string $xml
@param string $soapHeaderName
@return string the SOAP header value or an empty string if the header isn't
found
Gets the value of the specified SOAP header from the specified SOAP request or response payload as an XML string .