Adding PHP variable in an XML content

  php, xml

i am trying to add a PHP variable in an XML POST content but it dosent works, i am sure i am missing something silly.

      CURLOPT_POSTFIELDS =>"<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">rn    
<Body>rn   
     <catalogGetCategories xmlns="urn:Magento">rn            
<sessionId>26720f4893d4530279b93b5c3bce7231</sessionId>rn        
</catalogGetCategories>rn    </Body>rn</Envelope>",

the Session ID is variable and i am tryng to do like this

      CURLOPT_POSTFIELDS =>"<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">rn    
<Body>rn        
<catalogGetCategories xmlns="urn:Magento">rn            
<sessionId>".$token."</sessionId>rn        </catalogGetCategories>rn    </Body>rn</Envelope>",

i get wrong XML format error.

Source: Ask PHP

LEAVE A COMMENT