Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Till now from the Google, i got some html parser for parsing HTML page. but i am unable to choose one from them. Below is my objective-

  1. Parse the values dynamically from html page, which conatins JS. I need to parse some of these JS also.
  2. Send GET/POST req to the server with extracted values

Part 1 seems little bit complicated yet, since i am not able to pick better parser. Help Please.

Below is the snippet of html page-

<input style="display: none;" name="hiddenAction" value="myval" type="hidden">
<input name="ml_uiss" id="ml_uiss" value="aba972kd82lw" type="hidden">
<input style="display: none;" name="Key" id="Key" value="56n8f48jfn98cwnc38c398nc83nx2b9c32n.an24" type="text">
<input name="AvKbkGPQr" class="iswickEnabled input" maxlength="10" id="AvKbkGPQr" onkeyup="javascript:checkIt(this);" onkeydown="javascript:checkIt(this);" onchange="javascript:checkIt(this);" value="1234567890" onfocus="this.value='';" type="text"> <input name="PjbkAPker" class="iswickEnabled input" maxlength="10" id="PjbkAPker" onkeyup="javascript:checkIt(this);" onkeydown="javascript:checkIt(this);" onchange="javascript:checkIt(this);" type="text"> 
<input id="timeCheck" name="timeCheck" value="23:38:20" type="hidden">
<input name="isDone" id="isDone" value="prq" type="hidden">

from the above html, i want to read below values-

ml_uiss=aba972kd82lw
key=56n8f48jfn98cwnc38c398nc83nx2b9c32n.an24
timeCheck=23:38:20

Below is the js snippet-

<script type="text/javascript"> 
var element = document.createElement("input"); 
element.setAttribute("type", "hidden");
element.setAttribute("value", "");
element.setAttribute("name", "AzPwXPs");
element.setAttribute("id", "AzPwXPs");
var foo = document.getElementById("dnipb"); 
foo.appendChild(element);
var element1 = document.createElement("input"); 
element1.setAttribute("type", "hidden");
element1.setAttribute("value", "6D6AB8AECC9B28235F1DE39D879537E1");
element1.setAttribute("name", "ZLZWNK");
element1.setAttribute("id", "ZLZWNK");
foo.appendChild(element1);
</script>

From the above js, i want to read below values-

AzPwXPs=
ZLZWNK=6D6AB8AECC9B28235F1DE39D879537E1
share|improve this question
i dont know what you want to parse, but if you just want a few specific values, regex is usually a better approach than parsing the entire document – x4rf41 May 3 at 10:55
If the JS is generating some data and you want to get this data then it would be hard. You may check this answer to "run" JS on the server with PHP. And then use DOM or something similar to parse it. – HamZa DzCyberDeV May 3 at 11:02
ok.. let me append the snippet of the html page – Ravi Joshi May 3 at 11:02
Please have a look into updated question. Thank you for the suggestions. – Ravi Joshi May 3 at 11:10
@RaviJoshi How did you get that HTML ? Did you get it with Firebug or directly by checking the source (ctrl+u) ? – HamZa DzCyberDeV May 3 at 11:12
show 3 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.