fork download
  1. <?php
  2. $get = '<!DOCTYPE html>
  3. <html>
  4. <head>
  5. <title></title>
  6. </head>
  7. <body>
  8. <input value="2530317381" name="X-Tmx-session-id" id="X-Tmx-session-id" type="hidden">
  9. <input value="2530317382" name="X-Tmx-session-id" id="X-Tmx-session-id" type="hidden">
  10. <input value="2530317383" name="X-Tmx-session-id" id="X-Tmx-session-id" type="hidden">
  11. <input value="2530317384" name="X-Tmx-session-id" id="X-Tmx-session-id" type="hidden">
  12. </body>
  13. </html>';
  14.  
  15. $doc = new DOMDocument();
  16. @$doc->loadHTML($get);
  17.  
  18. $xpath = new DOMXpath($doc);
  19. $doc = NULL;
  20.  
  21. $allInputs = $xpath->query('*/input[@id=\'X-Tmx-session-id\']');
  22.  
  23. foreach ($allInputs as $input) {
  24. echo 'valor do input: ', $input->getAttribute('value'), PHP_EOL;
  25. }
Success #stdin #stdout 0.02s 24448KB
stdin
Standard input is empty
stdout
valor do input: 2530317381
valor do input: 2530317382
valor do input: 2530317383
valor do input: 2530317384