I need a good php URL decoder for API testing

Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"

Top Level » DirectAdmin » API and Plugins

I need a good php URL decoder for API testingLast Modified: Nov 29, 2019, 12:50 am
This is the php code that I use to test all new API output:

<title>url decode</title>
pre {
       margin: 0px;
div {
       border: 1px solid #d9d9d9;
if (isset($_POST['str']))

$sub_array = true;
if ($str_s!='' && !(isset($_POST['sub_array']) && $_POST['sub_array'] == 'yes'))
       $sub_array = false;

<form action='?' method=POST>
<textarea name=str cols=120 rows=10><?php
       echo html_char($str_s);

<input type=checkbox name='sub_array' value='yes' <?php if ($sub_array) echo 'checked';?>> Contains multi-level URL encoding<br>
<input type=submit>



function show_enc($str2, $tab=0)
       global $sub_array;

       $c = "style='margin-left: ".(($tab+1)*20)."px'";
       echo "<div $c>";

       parse_str($str2, $output);

       foreach ($output as $key => $value)
               echo "<pre><b>".html_char(urldecode($key))."</b> = ";

               if ($sub_array && strpos($value, '=') !== false)
                       show_enc($value, $tab+1);
                       echo html_char(urldecode($value));

               echo "</pre>";
       echo "</div>\n";

function html_char($str)
       $h = htmlspecialchars(stripslashes($str), ENT_QUOTES | ENT_HTML401);
       if ($h == '' && $str != '')
               return htmlspecialchars(utf8_encode(stripslashes($str)), ENT_QUOTES | ENT_HTML401);
               return $h;


If you need to decode a list similar to:


then use something similar to this:

$a = explode('&', $str);
$values = Array();

foreach ($a as $v)
   $values[$i++] = substr(strstr($v, '='), 1);


© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST