Getting document.getElementsByName from another page PHP/javascript

Posted by DarkN3ss on Stack Overflow See other posts from Stack Overflow or by DarkN3ss
Published on 2013-11-01T21:36:28Z Indexed on 2013/11/01 21:53 UTC
Read the original article Hit count: 168

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about php