title: How do I send XML data to an API via SOAP in PHP?
body: <p>I am having trouble sending data in a SOAP request to an API in PHP.</p>
  
  <p><strong>Security Information</strong></p>
  
  <pre><code>$security_info = array(
      "SecurityInfo" =&gt; array(
          'Username' =&gt; REEF_USERNAME,
          'Password' =&gt; REEF_PASSWORD
      )
  );
  </code></pre>
  
  <p><strong>Data</strong></p>
  
  <pre><code>$data = array (
      'Lead' =&gt; array (
          'DealerCode' =&gt; 12345,
    ),
  );
  </code></pre>
  
  <p><strong>Soap Request</strong></p>
  
  <pre><code>$URL = 'http://www.reefservices.co.uk/leadws/lead.asmx';
  
  $client = new SoapClient("http://www.reefservices.co.uk/leadws/lead.asmx?WSDL" , array(
      'location' =&gt; $URL,
      'uri'      =&gt; "http://www.reefservices.co.uk/leadws/",
      'trace'    =&gt; 1,)
  );
  
  $return = $client-&gt;Submit(  $security_info  );
  </code></pre>
  
  <p>Now, no matter what I put in the actual Submit function, I get the following error by print_r($result):</p>
  
  <pre><code>object(stdClass)[4]
    public 'SubmitResult' =&gt; string 'No data is provided.' (length=20)
  </code></pre>
  
  <p>The API file is here: <strong><a href="http://www.reefservices.co.uk/leadws/lead.asmx?WSDL" rel="nofollow">http://www.reefservices.co.uk/leadws/lead.asmx?WSDL</a></strong></p>
  
  <p>I have tried sending XML data (as that is what is required), strings, arrays, objects, everything, and it just throws error at me, no data is provided.</p>
  
  <p>I have the API spec here and it states a lot of XML fields that are required, could this be why it fails? Because I have not sent ALL the data? </p>
  
  <p>Edit: API Spec: <a href="https://dl.dropboxusercontent.com/u/37562853/WebService--WebLeads.pdf" rel="nofollow">Here</a></p>
  
  <p>The final solution is found <a href="http://pastebin.com/ZXinFhcH" rel="nofollow">Here</a>, working as intended!</p>