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

  • Home
  • SEARCH
  • 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 845199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:24:34+00:00 2026-05-15T06:24:34+00:00

I have a script that is designed to parse XML postbacks from Ultracart, right

  • 0

I have a script that is designed to parse XML postbacks from Ultracart, right now just dumps it into a MySQL table. The script works fine if I point it to a XML file on my localhost but using ‘php://input’ it doesn’t seem to grabbing anything. My logs show apache returning 200 after the post so I have no idea what could be wrong or how to drill down the issue.. here’s the code:

  $doc = new DOMDocument();
  $doc->loadXML($page);

  $handle = fopen("test2/".time().".xml", "w+");
  fwrite($handle,trim($page)); // it doesn't save this either :'(
  fclose();

  require_once('includes/database.php');

  $db = new Database('localhost', 'user', 'password', 'db_name');
  $data = array();

   $exports = $doc->getElementsByTagName("export");
   foreach ($exports as $export) {
     $orders = $export->getElementsByTagName("order");
     foreach($orders as $order) {
        $data['order_id'] = $order->getElementsByTagName("order_id")->item(0)->nodeValue;
        $data['payment_status'] = $order->getElementsByTagName("payment_status")->item(0)->nodeValue;
        $date_array = explode(" ",$order->getElementsByTagName("payment_date_time")->item(0)->nodeValue);

            if ($date_array[1] == 'JAN') { $date_array[1] = '01'; }
            if ($date_array[1] == 'FEB') { $date_array[1] = '02'; }
            if ($date_array[1] == 'MAR') { $date_array[1] = '03'; }
            if ($date_array[1] == 'APR') { $date_array[1] = '04'; }
            if ($date_array[1] == 'MAY') { $date_array[1] = '05'; }        // converts Ultracart date to
            if ($date_array[1] == 'JUN') { $date_array[1] = '06'; }        // MySQL date
            if ($date_array[1] == 'JUL') { $date_array[1] = '07'; }
            if ($date_array[1] == 'AUG') { $date_array[1] = '08'; }
            if ($date_array[1] == 'SEP') { $date_array[1] = '09'; }
            if ($date_array[1] == 'OCT') { $date_array[1] = '10'; }
            if ($date_array[1] == 'NOV') { $date_array[1] = '11'; }
            if ($date_array[1] == 'DEC') { $date_array[1] = '12'; }

        $data['payment_date'] = $date_array[2]."-".$date_array[1]."-".$date_array[0];
        $data['payment_time'] = $date_array[3];

        //... we'll skip this, there are 80 some elements

        $data['discount'] = $order->getElementsByTagName("discount")->item(0)->nodeValue;
        $data['distribution_center_code'] = $order->getElementsByTagName("distribution_center_code")->item(0)->nodeValue;
            }
        }
    }
        $db->insert('order_history',$data);
} else die('ERROR: Token Check Failed!');
  • 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-05-15T06:24:35+00:00Added an answer on May 15, 2026 at 6:24 am

    Without seeing the code above that point, I’d suggest that you dump the output straight out and see if you’re actually receiving the XML. I doubt the problem is with your parsing, but with receiving the postback. Looking at the ultracart documentation, it looks to me like they aren’t passing the the body of the xml in as a post parameter, but probably as an HTTP PUT which is fairly whacky.

    http://php.net/manual/en/features.file-upload.put-method.php

    I’d wager on most shared hosting etc, PUT support is pretty limited or not supported by default. I’d look there first.

    Josh

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

Sidebar

Ask A Question

Stats

  • Questions 450k
  • Answers 450k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm not sure if I understand exactly what you are… May 15, 2026 at 8:28 pm
  • Editorial Team
    Editorial Team added an answer BTW this was 'fixed' (workaround) quite easily. Bug disappears if… May 15, 2026 at 8:28 pm
  • Editorial Team
    Editorial Team added an answer Delete the foreign keys, then the table. May 15, 2026 at 8:28 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.