title: How can I receive this request in another server using curl and php
body: <p>I'm new here so please be patient, This is my request code, I want to write another piece of code in another server that will be accepting it and returning an xml 7101 success code using php and curl. How do I write code in a receiving server. This is actually API  that I will be using to exchange data between my system and another remote system stored in clouds I have managed to send request successfully but I have stuck at receiving their requests, I have spent an entire week on it please help me out on receiving the requests when they send them to me.</p>
  
  <p>success code is </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;gepgBillSubReqAck&gt;
      &lt;TrxStsCode&gt;7101&lt;/TrxStsCode&gt;
  &lt;/gepgBillSubReqAck&gt;
  </code></pre>
  
  <p>the request code is this,</p>
  
  <pre><code>&lt;?php
  
      //Bill Request 
      $content ="&lt;gepgBillSubReq&gt;
          &lt;BillHdr&gt;
              &lt;SpCode&gt;SP103&lt;/SpCode&gt;
              &lt;RtrRespFlg&gt;true&lt;/RtrRespFlg&gt;
          &lt;/BillHdr&gt;
          &lt;BillTrxInf&gt;
              &lt;BillId&gt;1812022009968&lt;/BillId&gt;
              &lt;SubSpCode&gt;1001&lt;/SubSpCode&gt;
              &lt;SpSysId&gt;TANESCO001&lt;/SpSysId&gt;
              &lt;BillAmt&gt;1180&lt;/BillAmt&gt;
              &lt;MiscAmt&gt;0&lt;/MiscAmt&gt;
              &lt;BillExprDt&gt;2017-12-31T23:59:59&lt;/BillExprDt&gt;
              &lt;PyrId&gt;5144AA5914&lt;/PyrId&gt;
              &lt;PyrName&gt;test&lt;/PyrName&gt;
              &lt;BillDesc&gt;Bill Number 5913&lt;/BillDesc&gt;
              &lt;BillGenDt&gt;2017-12-21T09:39:00&lt;/BillGenDt&gt;
              &lt;BillGenBy&gt;Bhstenkubo&lt;/BillGenBy&gt;
              &lt;BillApprBy&gt;Bhstenkubo&lt;/BillApprBy&gt;
              &lt;PyrCellNum/&gt;
              &lt;PyrEmail/&gt;
              &lt;Ccy&gt;TZS&lt;/Ccy&gt;
              &lt;BillEqvAmt&gt;1180&lt;/BillEqvAmt&gt;
              &lt;RemFlag&gt;false&lt;/RemFlag&gt;
              &lt;BillPayOpt&gt;1&lt;/BillPayOpt&gt;
              &lt;BillItems&gt;
                  &lt;BillItem&gt;
                      &lt;BillItemRef&gt;5144AA5914&lt;/BillItemRef&gt;
                      &lt;UseItemRefOnPay&gt;N&lt;/UseItemRefOnPay&gt;
                      &lt;BillItemAmt&gt;1180&lt;/BillItemAmt&gt;
                      &lt;BillItemEqvAmt&gt;1180&lt;/BillItemEqvAmt&gt;
                      &lt;BillItemMiscAmt&gt;0&lt;/BillItemMiscAmt&gt;
                      &lt;GfsCode&gt;140316&lt;/GfsCode&gt;
                  &lt;/BillItem&gt;
              &lt;/BillItems&gt;
          &lt;/BillTrxInf&gt;
      &lt;/gepgBillSubReq&gt;";
  
      $resultCurlPost = "";
  
      $serverIp = "XXXXXXXXXXXXXXXX";
  
      $uri = "/XXX/XXX/qrequest"; //this is for qrequest
  
      echo "Message ready to GePG:"."\n".$content."\n";
  
      $ch = curl_init($serverIp.$uri);
      curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
      curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
      curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                          'Content-Type:application/xml',
                          'Gepg-Com:default.sp.in',
                          'Gepg-Code:SP103',
                          'Content-Length:'.strlen($content))
      );
  
      curl_setopt($ch, CURLOPT_TIMEOUT, 50);
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 50);
  
      //Capture returned content from GePG
      $resultCurlPost = curl_exec($ch);
      curl_close($ch);
      //$resultCurlPost=$data; 
      if(!empty($resultCurlPost)){
  
          echo "\n\n";
          echo "Received Response\n";
          echo  $resultCurlPost;
          echo "\n";              
      }
      else
      {
          echo "No result Returned"."\n";
      }
  
  ?&gt;
  </code></pre>