How to parse javascript in PHP page with Java? -
i want retrieve value of javascript section in php file application in java.
the php page contain :
<script type="text/javascript"> var tab= new array(); tab[0] = "value0"; tab[1] = "value1"; tab[2] = "value2"; </script>
i'm using jsoup parsing html tag. tried use rhino don't find example.
context context = context.enter(); scriptable scope = context.initstandardobjects(); object result = null; reader reader = new inputstreamreader(inputstreamofthepage); result = context.evaluatereader(scope, reader, "page", 1 , null ); scriptable varvalue = (scriptable)scope.get("tab", scope); string valuestr = (string)varvalue .get("tab[0]", varvalue );
it's giving me exception : java.lang.classcastexception: org.mozilla.javascript.uniquetag cannot cast org.mozilla.javascript.scriptable
i don't know how cast object. maybe there better way want.
thanks
jsoup not suitable parse javascript... it's normal doesn't work !
Comments
Post a Comment