Software, your way.
burger menu icon
WillMaster

WillMaster > LibraryWeb Content Preparation

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Data Dump V2

Data Dump V2 simply publishes all the data it receives or otherwise has available when the software is loaded in a browser — which includes when a form temporarily uses it as a thank-you or confirmation page.

The software is quite useful when testing forms. It is the easiest web page form testing software I have used. As indicated above, Data Dump V2 displays whatever information it receives.

Install a copy of Data Dump V2 on your server and have a wonderful testing tool available.

The first version of Data Dump was published in 2011. This second version added two information elements (form upload information and raw POST data).

Here is a short explanation of each information item that Data Dump V2 intercepts and publishes.

(When form submissions or form data are mentioned, they can be via a web page or via automated server-side software like cURL.)

  1. Method POST — When a form with method="post" is submitted to the data dump software, Data Dump V2 will display the form field names and their values. All form fields that are submitted are displayed, including hidden fields and, if applicable, button names and values.

  2. Method GET — Similar to method POST, when a form with method="get" is submitted to the data dump software, the received names and values are displayed.

  3. Uploaded FILE Data — When using a form to upload files (form field type="file"), the upload information is processed with a special $_FILES array. Form type="file" fields can be single or multiple files; and may have unique or identical field names (with [] appended). Data Dump V2 will display an array of all upload data (name, size, type, …), so any combination of form upload fields can be represented.

  4. Raw POST — When the form data is sent to the data dump software with method POST, but not formated as standard name=value information, then Data Dump V2 publishes a copy of what was submitted. (An example of unformatted information is server software submitting the data instead of a web page form — JSON-encoded data, an image file, or any other data not formatted as normal name=value pairs.)

  5. Cookies — If the data dump software receives cookie information from the browser, the cookies are displayed.

  6. Environment Variables — The PHP script maintains a number of environment variables. They are displayed here in case some of the information is useful. For example, it shows what method was used to submit the form.

<?php
/*
Raw Data Dump
Version 1.1
August 15, 2023
Added uploaded FILES information and raw POST data information
(Version 1.0 was published year 2011)
Will Bontrager Software LLC
https://www.willmaster.com/
*/
$rawdata = file_get_contents("php://input");
?><!DOCTYPE html>
<html lang="en">
<head> 
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Data Dump V2</title>
<style type="text/css">
* { box-sizing:border-box; }
html { font-family:sans-serif; font-size:100%; }
a { text-decoration:none; }
.outside-value-box { display:table; border-top:2px solid black; border-bottom:2px solid black; border-left:2px solid black; border-top-left-radius:6px; border-bottom-left-radius:6px; padding:2px 0 0px 3px; margin:0 0 1em 0; overflow:auto; }
.within-value-box { white-space:nowrap; padding:2px 0 2px 6px; border-top:1px solid black; margin-left:-3px; margin-top:1px; }
h3 { margin-top:1.5em; }
</style>
</head>
<body><div style="display:table; margin:.25in auto;">
<h1 style="font-weight:normal; letter-spacing:3px;">Data Dump <a href="https://www.willmaster.com/"><img src="https://www.willmaster.com/images/wmlogo_icon.gif" alt="Willmaster.com" title="Courtesy of Willmaster.com"></a></h1>

<?php
if( count($_GET) )
{
   echo('<h3>&bull; Received data method GET &mdash;</h3>');
   PrintValues($_GET);
}
else { echo('<h3 style="font-style:italic;">No method GET data received.</h3>'); }

if( strlen($rawdata) )
{
   echo "<h3>&bull; Raw POST Data:</h3>";
   echo $rawdata;
}
else { echo('<h3 style="font-style:italic;">No raw POST data received.</h3>'); }

if( count($_POST) )
{
   echo('<h3>&bull; Received data method POST &mdash;</h3>');
   PrintValues($_POST);
}
else { echo('<h3 style="font-style:italic;">No method POST data received.</h3>'); }

if( count($_FILES) )
{
   echo('<h3>&bull; Raw of received FILES data &mdash;</h3>');
   echo '<pre>'.print_r($_FILES,true).'</pre>';
   #PrintValues($_FILES);
}
else { echo('<h3 style="font-style:italic;">No FILES data received.</h3>'); }

if( count($_COOKIE) )
{
   echo('<h3>&bull; Cookies data &mdash;</h3>');
   PrintValues($_COOKIE);
}
else { echo('<h3 style="font-style:italic;">No cookies received from browser.</h3>'); }

if( count($_SERVER) )
{
   echo('<h3>&bull; Environment variables &mdash;</h3>');
   PrintValues($_SERVER);
}

function PrintValues(&$ar)
{
   ksort($ar);
   foreach($ar as $k => $v)
   {
      $pk = htmlspecialchars($k);
      if( is_array($ar[$k]) )
      {
         $counter = 0;
         $pkh = array();
         foreach( $ar[$k] as $kk => $vv )
         {
            if( empty($vv) ) { $pv = ' '; }
            else { $pv = htmlspecialchars($vv); }
            $pkh[$counter] = $pk.'['.$counter.']'."\t$pv";
            $counter++;
         }
         foreach( $pkh as $tpk => $tpv )
         {
            list($tk,$tv) = explode("\t",$tpv,2);
            echo "<div class='outside-value-box'>$tk";
            echo "<div class='within-value-box'>$tv</div></div>";
         }
      }
      else
      {
         if( empty($v) ) { $pv = '&nbsp;'; }
         else { $pv = htmlspecialchars($v); }
         echo "<div class='outside-value-box'>$pk";
         echo "<div class='within-value-box'>$pv</div></div>";
      }
   }
}
?>
<p style="margin-top:50px;">
Copyright 2023 <a href="https://www.willmaster.com/">Will Bontrager Software LLC</a>
</p>
</body>
</html>

Installation is copy and paste: Name the file datadump.php or other preferred *.php file name. Make a note of the installed software's URL.

To use, temporarily replace the action value of your form tag with the URL of the installed Data Dump V2 software.

I think you will appreciate the data dump tool, especially if you do occasional or more website developing.

(This content first appeared in Possibilities newsletter.)

Will Bontrager

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC