title: How do I make a SOAP-request in php, just like in SoapUI?
body: <p>I am all new to php and all lost in doing a soap request. I have this other question <a href="https://stackoverflow.com/questions/55539930/how-to-send-a-soap-request-in-javascript-like-in-soapui">How to send a SOAP request in javascript, like in SoapUI</a>, which I have just got answered, but I have now decided to work in php instead of Node.js. As I want my php code to do the exact same, I will repeat my earlier question down below:</p>
  
  <p>I have this WSDL site that I need to get some answers from. I have figured out how to do this in SoapUI, but I have no idea how to do it in php. The request that I am sending in soapUI looks like this:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:uni="https://uni-login.dk"&gt;
     &lt;soap:Header/&gt;
     &lt;soap:Body&gt;
        &lt;uni:hentDataAftaler&gt;
           &lt;uni:wsBrugerid&gt;?&lt;/uni:wsBrugerid&gt;
           &lt;uni:wsPassword&gt;?&lt;/uni:wsPassword&gt;
        &lt;/uni:hentDataAftaler&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>I also have the wsdl-link: <a href="https://wsiautor.uni-login.dk/wsiautor-v4/ws?WSDL" rel="nofollow noreferrer">https://wsiautor.uni-login.dk/wsiautor-v4/ws?WSDL</a></p>
  
  <p>I hope you I have some suggestions and tell me if you need any more information to answer my question :)</p>
  
  <p>The answer for my previous question was the following</p>
  
  <pre><code>    const soapRequest = require('easy-soap-request');
      const url = 'https://wsiautor.uni-login.dk/wsiautor-v4/ws';
      const headers = {
        'Content-Type': 'application/soap+xml;charset=UTF-8',
        'soapAction': 'https://wsiautor.uni-login.dk/hentDataAftaler',
  };
  // example data
  const xml = `
  &lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:uni="https://uni-login.dk"&gt;
     &lt;soap:Header/&gt;
     &lt;soap:Body&gt;
        &lt;uni:hentDataAftaler&gt;
           &lt;uni:wsBrugerid&gt;?&lt;/uni:wsBrugerid&gt;
           &lt;uni:wsPassword&gt;?&lt;/uni:wsPassword&gt;
        &lt;/uni:hentDataAftaler&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  `;
  
  
  // usage of module
  soapRequest(url, headers, xml).then(({response: {body, statusCode}}) =&gt; {
      console.log(body);
      console.log(statusCode);
  }).catch((errorBody) =&gt; {
      console.error(errorBody);
  });
  </code></pre>