title: How to read XML response from another site after submission of a html form
body: <p>In my website, I am submitting a html form to a payment site (webmasterchecks.com) and the site responses me by XML response. The XML response is displaying on external link (https://api.webmasterchecks.com/payments/add) after normal form submission(by clicking on submit button). I want to read the XML response and update my database. My coding language is PHP.</p>
  
  <p><strong>HTML form:</strong></p>
  
  <pre><code>&lt;form name="payment_form" action="https://api.webmasterchecks.com/payments/add" method="post"&gt;
  
  &lt;input type="text" name="client_id" value="****"&gt;&lt;/input&gt;
  &lt;input type="text" name="akey" value="**********"&gt;&lt;/input&gt;
  &lt;input type="text" name="method_id" value="2"&gt;&lt;/input&gt;
  &lt;input type="text" name="payee" value="ABCD EFGH"&gt;&lt;/input&gt;
  &lt;input type="text" name="amount" value="1.00"&gt;&lt;/input&gt;
  &lt;input type="text" name="postage_id" value="6"&gt;&lt;/input&gt;
  &lt;input type="text" name="reference" value="Payment"&gt;&lt;/input&gt;
  &lt;input type="text" name="street_addr" value="51 ABCD"&gt;&lt;/input&gt;
  &lt;input type="text" name="city" value="XYZ"&gt;&lt;/input&gt;
  &lt;input type="text" name="state" value="NJ"&gt;&lt;/input&gt;
  &lt;input type="text" name="country" value="United States"&gt;&lt;/input&gt;
  &lt;input type="text" name="zip" value="01544"&gt;&lt;/input&gt;
  &lt;input type="submit" name="submit" value="submit"&gt;&lt;/input&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I tried to submit the form using jquery post and get the json data. But The form is not submitting (not getting any error in console as well). Code is given below.</p>
  
  <pre><code>$(function(){
        $("form[name=payment_form]").submit(function(){
          $.post($(this).attr("action"), $(this).serialize(), function(jsonData){
              alert(jsonData);
          }, "json");
          return false;
        });
      });
  </code></pre>
  
  <p>I also tried to use curl, but did not succeed. Its displaying the API key is invalid where as using the above html form, i am getting response. CURL code is given below. </p>
  
  <pre><code>   $client_id = "****";
     $api_key = "*****************************";
  
     $output_url = "https://api.webmasterchecks.com/payments/add";
  
     $output_transaction  = "client_id=$client_id&amp;";
     $output_transaction .= "akey=$api_key&amp;";
     $output_transaction .= "method_id=2&amp;";
     $output_transaction .= "payee=ABCD EFGH&amp;";
     $output_transaction .= "amount=1.00&amp;";
     $output_transaction .= "postage_id=6&amp;";
     $output_transaction .= "reference=Payment&amp;";
     $output_transaction .= "street_addr=FGHFHGFG&amp;";
     $output_transaction .= "city=JHGJHG&amp;";
     $output_transaction .= "state=NJ&amp;";
     $output_transaction .= "country=United States&amp;";
     $output_transaction .= "zip=54545454";
  
      ob_start();
      $ch = curl_init ($output_url); 
      curl_setopt ($ch, CURLOPT_VERBOSE, 1);
      curl_setopt ($ch, CURLOPT_POST, 1);
      curl_setopt ($ch, CURLOPT_POSTFIELDS, $output_transaction);
      curl_exec ($ch);
      curl_close ($ch);
      $process_result = ob_get_contents();
      ob_end_clean();
  </code></pre>
  
  <p>How can i update my database using the XML response?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>My api key contains few plus "+" sign on it. Sample format of API key is given below.</p>
  
  <p>q5Un5ObLZs2ovY2COW+LvHzEVdUy0kR3u6dPwh/p+wzlbh80vONBbo+otLpBwPqnvP/VjhglfFos51sLFDpUHi+6GnVbLtR3ATjSz9trGoKLFgrK/ostPUG4t9XV1EdS10JzVZFscIxUu2LVmJN9NVpCgaD9NaA</p>