Getting document.getElementsByName from another page PHP/javascript
- by DarkN3ss
so i have been looking around on how to do this but with no success.
Im trying to get the value of the name test from an external website
<input type="hidden" name="test" value="ThisIsAValue" />
But so far i have only found how to get the value of that with an ID
<input type="hidden" id="test" name="test" value="ThisIsAValue" autocomplete="off" />
but I need to try find it without a ID is my problem.
And this is an example on how to get it from the ID
<?php
$doc = new DomDocument;
$doc->validateOnParse = true;
$doc->loadHtml(file_get_contents('http://example.com/bla.php'));
var_dump($doc->getElementById('test'));
?>
And i have found how to get it from name and NOT ID on the same page
<script>
function getElements()
{
var test = document.getElementsByName("test")[0].value;
alert(test);
}
</script>
But again I dont know how to get the value of it by name from an external page eg "http://example.com/bla.php", any help?
Thanks