<?php
$html = <<<EOD
<form method="post" action="">
<input type="hidden" name="produto1" value="teste1">
<input type="hidden" name='produto2' value="teste2">
<input name="produto3" type="hidden" value="teste3">
<input type="hidden" name='produto4' value="teste4">
<input type="hidden" name="produto5" value="teste5">
<input type="submit" value="enviar">
</form>
EOD;
$dom = new DOMDocument();
$dom->loadHTML($html);
$inputs = $dom->getElementsByTagName('input');
foreach ($inputs as $input) {
echo $input->getAttribute('name') . "\n";
}
PD9waHAKCiRodG1sID0gPDw8RU9ECjxmb3JtIG1ldGhvZD0icG9zdCIgYWN0aW9uPSIiPgogICAgPGlucHV0IHR5cGU9ImhpZGRlbiIgbmFtZT0icHJvZHV0bzEiIHZhbHVlPSJ0ZXN0ZTEiPgogICAgPGlucHV0IHR5cGU9ImhpZGRlbiIgbmFtZT0ncHJvZHV0bzInIHZhbHVlPSJ0ZXN0ZTIiPgogICAgPGlucHV0IG5hbWU9InByb2R1dG8zIiB0eXBlPSJoaWRkZW4iIHZhbHVlPSJ0ZXN0ZTMiPgogICAgPGlucHV0IHR5cGU9ImhpZGRlbiIgbmFtZT0ncHJvZHV0bzQnIHZhbHVlPSJ0ZXN0ZTQiPgo8aW5wdXQgdHlwZT0iaGlkZGVuIiBuYW1lPSJwcm9kdXRvNSIgdmFsdWU9InRlc3RlNSI+CiAgICAKPGlucHV0IHR5cGU9InN1Ym1pdCIgdmFsdWU9ImVudmlhciI+CjwvZm9ybT4KRU9EOwogCiRkb20gPSBuZXcgRE9NRG9jdW1lbnQoKTsKJGRvbS0+bG9hZEhUTUwoJGh0bWwpOwogCiRpbnB1dHMgPSAkZG9tLT5nZXRFbGVtZW50c0J5VGFnTmFtZSgnaW5wdXQnKTsKCmZvcmVhY2ggKCRpbnB1dHMgYXMgJGlucHV0KSB7CgllY2hvICRpbnB1dC0+Z2V0QXR0cmlidXRlKCduYW1lJykgLiAiXG4iOwp9