Ben HTML kodu var bir parça var:
<form method="post" action="/">
<input type="hidden" name="example-name" value="example-value">
<button type="submit">Submit</button>
</form>
How can I extract value of the hidden input using DOMXPath in PHP? I have tried somethig like this:
//$site - the html code
$doc = new DOMDocument();
$doc->loadHTML($site);
$xpath = new DOMXpath($doc);
$kod = $xpath->query("//input[@name='example-name']");
foreach($kod as $node)
$values[]=$node->nodeValue;
return $values;
Ama bu boş bir dizi döndürür. Nerede hata nedir?