src/ET_Client.php
public function addOAuth( $doc, $token) 
	{		
		$soapDoc = $doc;
		$envelope = $doc->documentElement;
		$soapNS = $envelope->namespaceURI;
		$soapPFX = $envelope->prefix;
		$SOAPXPath = new DOMXPath($doc);
		$SOAPXPath->registerNamespace('wssoap', $soapNS);
        $SOAPXPath->registerNamespace('wswsse', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd');

		$headers = $SOAPXPath->query('//wssoap:Envelope/wssoap:Header');
		$header = $headers->item(0);
		if (! $header) {
			$header = $soapDoc->createElementNS($soapNS, $soapPFX.':Header');
			$envelope->insertBefore($header, $envelope->firstChild);
		}

		$authnode = $soapDoc->createElementNS('http://exacttarget.com', 'oAuth');
		$header->appendChild($authnode);
		
		$oauthtoken = $soapDoc->createElementNS(null,'oAuthToken',$token);
		$authnode->appendChild($oauthtoken);
	}
public function addOAuth( $doc, $token) 
	{		
		$soapDoc = $doc;
		$envelope = $doc->documentElement;
		$soapNS = $envelope->namespaceURI;
		$soapPFX = $envelope->prefix;
		$SOAPXPath = new DOMXPath($doc);
		$SOAPXPath->registerNamespace('wssoap', $soapNS);
        $SOAPXPath->registerNamespace('wswsse', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd');

		$headers = $SOAPXPath->query('//wssoap:Envelope/wssoap:Header');
		$header = $headers->item(0);
		if (! $header) {
			$header = $soapDoc->createElementNS($soapNS, $soapPFX.':Header');
			$envelope->insertBefore($header, $envelope->firstChild);
		}

		$authnode = $soapDoc->createElementNS('http://exacttarget.com', 'oAuth');
		$header->appendChild($authnode);
		
		$oauthtoken = $soapDoc->createElementNS(null,'oAuthToken',$token);
		$authnode->appendChild($oauthtoken);
	}
public function addOAuth ( $ doc , $ token ) { $ soapDoc = $ doc ; $ envelope = $ doc -> documentElement ; $ soapNS = $ envelope -> namespaceURI ; $ soapPFX = $ envelope -> prefix ; $ SOAPXPath = new DOMXPath ( $ doc ) ; $ SOAPXPath -> registerNamespace ( 'wssoap' , $ soapNS ) ; $ SOAPXPath -> registerNamespace ( 'wswsse' , 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' ) ; $ headers = $ SOAPXPath -> query ( '//wssoap:Envelope/wssoap:Header' ) ; $ header = $ headers -> item ( 0 ) ; if ( ! $ header ) { $ header = $ soapDoc -> createElementNS ( $ soapNS , $ soapPFX . ':Header' ) ; $ envelope -> insertBefore ( $ header , $ envelope -> firstChild ) ; } $ authnode = $ soapDoc -> createElementNS ( 'http://exacttarget.com' , 'oAuth' ) ; $ header -> appendChild ( $ authnode ) ; $ oauthtoken = $ soapDoc -> createElementNS ( null , 'oAuthToken' , $ token ) ; $ authnode -> appendChild ( $ oauthtoken ) ; }
Add OAuth token to the header of the soap request

@param string $doc Soap request as xml string
@param string $token OAuth token
@return void
Add OAuth token to the header of the soap request