Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8461395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:52:07+00:00 2026-06-10T13:52:07+00:00

In my website, I am submitting a html form to a payment site (webmasterchecks.com)

  • 0

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.

HTML form:

<form name="payment_form" action="https://api.webmasterchecks.com/payments/add" method="post">

<input type="text" name="client_id" value="****"></input>
<input type="text" name="akey" value="**********"></input>
<input type="text" name="method_id" value="2"></input>
<input type="text" name="payee" value="ABCD EFGH"></input>
<input type="text" name="amount" value="1.00"></input>
<input type="text" name="postage_id" value="6"></input>
<input type="text" name="reference" value="Payment"></input>
<input type="text" name="street_addr" value="51 ABCD"></input>
<input type="text" name="city" value="XYZ"></input>
<input type="text" name="state" value="NJ"></input>
<input type="text" name="country" value="United States"></input>
<input type="text" name="zip" value="01544"></input>
<input type="submit" name="submit" value="submit"></input>
</form>

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.

$(function(){
      $("form[name=payment_form]").submit(function(){
        $.post($(this).attr("action"), $(this).serialize(), function(jsonData){
            alert(jsonData);
        }, "json");
        return false;
      });
    });

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.

   $client_id = "****";
   $api_key = "*****************************";

   $output_url = "https://api.webmasterchecks.com/payments/add";

   $output_transaction  = "client_id=$client_id&";
   $output_transaction .= "akey=$api_key&";
   $output_transaction .= "method_id=2&";
   $output_transaction .= "payee=ABCD EFGH&";
   $output_transaction .= "amount=1.00&";
   $output_transaction .= "postage_id=6&";
   $output_transaction .= "reference=Payment&";
   $output_transaction .= "street_addr=FGHFHGFG&";
   $output_transaction .= "city=JHGJHG&";
   $output_transaction .= "state=NJ&";
   $output_transaction .= "country=United States&";
   $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();

How can i update my database using the XML response?

Thanks in advance.

EDIT

My api key contains few plus “+” sign on it. Sample format of API key is given below.

q5Un5ObLZs2ovY2COW+LvHzEVdUy0kR3u6dPwh/p+wzlbh80vONBbo+otLpBwPqnvP/VjhglfFos51sLFDpUHi+6GnVbLtR3ATjSz9trGoKLFgrK/ostPUG4t9XV1EdS10JzVZFscIxUu2LVmJN9NVpCgaD9NaA

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:52:08+00:00Added an answer on June 10, 2026 at 1:52 pm

    What you will need to do here is send your data through to a local script and then package it up into a curl request to interact with the remote server via its API.

    <form name="payment_form" action="local_script.php" method="post">
    <input type="text" name="method_id" value="2"></input>
    <input type="text" name="payee" value="ABCD EFGH"></input>
    <input type="text" name="amount" value="1.00"></input>
    <input type="text" name="postage_id" value="6"></input>
    <input type="text" name="reference" value="Payment"></input>
    <input type="text" name="street_addr" value="51 ABCD"></input>
    <input type="text" name="city" value="XYZ"></input>
    <input type="text" name="state" value="NJ"></input>
    <input type="text" name="country" value="United States"></input>
    <input type="text" name="zip" value="01544"></input>
    <input type="submit" name="submit" value="submit"></input>
    </form>
    

    Note I have removed client_id and api_key from the form as these should never be shown to the public like this

    local_script.php

    $api_url = "https://api.webmasterchecks.com/payments/add";
     $client_id = "****";
       $api_key = "*****************************";
    
    $_POST['client_id'] = $client_id;
    $_POST['akey'] = $api_key;
    
          $post_data = http_build_query($_POST);
    
        $xml = new DOMDocument();
        $ch = curl_init ($api_url); 
        curl_setopt($ch, CURLOPT_VERBOSE, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);//return xml
        curl_setopt($ch, CURLOPT_HEADER, FALSE);//we only need the body
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
        $xml->loadXML(curl_exec($ch));
        curl_close ($ch);
        //for testing echo xml
        echo $xml->saveXML();
        //you need now to parse the xml before adding info to db
        $name = $xml->getElementsByTagName('name')->item(1)->nodeValue;
        $email = $xml->getElementsByTagName('email')->item(1)->nodeValue;
    

    This is how I would do it, as I am versed in DOMDocument for parsing and writing xml,you can either parse using the manual for DOMDocument http://www.php.net/manual/en/class.domdocument.php or use SIMPLEXML http://php.net/manual/en/book.simplexml.php either way you need to parse the xml to add the data to your db.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My website at http://derek.genevievehoward.com/ will not display in Firefox, even though the HTML and
I am doing my first Java website, where a form in the war/MyWeb.html is
If a user is submitting a form through my website - does the server
Website: http://videojs.com/ How can I use the YouTube Skin on the frontpage? I'd really
The website in question is http://oxfordbeach.com/bynight/ If you resize the browser, the nav bar
My website project includes taking data from the user in the form of two
I have a website with a URL like: http://mysite.com/this-is-a-page and then I use that
I have a classifieds website. In the main page (index) I have several form
I have a classifieds website, and on each classified there is a tip-form where
We started following the CakePHP Blog tutorial hosted on the website cakephp.org - http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/part-two.html

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.