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

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -