How to get value in input using Zend\Dom\Query?

Trying to get the value input in the following code.
<input name="__RequestVerificationToken" type="hidden" value="cOpkqickNLImH72xbqz">

Do the following
use Zend\Dom\Query;

$dom = new Query($html); // The $html contains the html file with the code above
$results = $dom->execute('input[name="__RequestVerificationToken"]');

$count = count($results); // Value of $count is 1, so the element is successfully
echo $results->current()->nodeName; // Prints 'input' - > hmm... 
echo $results->current()->nodeValue; // Outputs a blank value. Why?

// Check regularaly
preg_match('/name="__RequestVerificationToken".+?value="([^"]+)"/', $html, $match);
echo $match[1];// Prints cOpkqickNLImH72xbqz

How to get value in input means Zend\Dom\Query?
June 10th 19 at 15:52
2 answers
June 10th 19 at 15:54
Solution
if($results->count()) {
 $value = $results->current()->getAttribute('value');
}


nodeName - name of node, exactly the same as in the DOM in the browser

nodeValue - content of a node, if any. Exactly the same as in the DOM in the browser

Maybe before close to do the parsing, you could use a brush up on basic knowledge about the DOM.
Kind of mystic. I think yesterday I tried to do it but I have cursed the lack of a method. And now it is all developed. Apparently still not doing something. - Roderick92 commented on June 10th 19 at 15:57
June 10th 19 at 15:56
reads the nodeValue is the text between the tags, type
<a>Text</a>
and input tag text no

here or to search in zend read the attributes of the tag, or send the form and read the form values for "name"
The actual question that was
How to get value in input means Zend\Dom\Query?

In the documentation I found nothing, and the method of experiments is also not stumbled upon the right solution.

echo $results->current()->nodeName;
Also displays not the name attribute, and tag name. How to get all attributes of the necessary tags? - Roderick92 commented on June 10th 19 at 15:59
and what is the task? you parsite html page? - Roderick92 commented on June 10th 19 at 16:02
Yes, it needs to parse, then this key should be transferred via POST at the entrance to the private area, and there already to parse out a large amount of data which has already Zend\Dom\Query well. But as it comes to attributes, it is necessary to parse through the regular season. In General, it looks very crooked - Pedro65 commented on June 10th 19 at 16:05

Find more questions by tags Zend Framework