Zdravim, mam celkem kruty problem.
HTML kod stranky vypada asi takto:
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMTAyMzY5NjExD2QWAmYPZBYGZg9kFgQCCg8" />
<input type="hidden" name="__VIEWSTATE1" id="__VIEWSTATE1" value="aGtFbmNfgfbfnfgn=" />
To nesrozumitelne se pri kazdem nacteni stranky meni, takze to potrebuju vytahnout v 1 kroku pri jednom nacteni a dale pouzit.
Pouzivam:
String[] __VIEWSTATE = new String[2];
Pattern p = Pattern.compile("<input type=\"hidden\" name=\"__VIEWSTATE\" id=\"__VIEWSTATE\" value=\"([^\"]+)\" /><input type=\"hidden\" name=\"__VIEWSTATE1\" id=\"__VIEWSTATE1\" value=\"([^\"]+)\" />");
Matcher m = p.matcher(cookies.doHttpGET("http://www.geocaching.com/track/", url));
if (m.find()) {
__VIEWSTATE[0] = m.group(1);
__VIEWSTATE[1] = m.group(2);
}
return __VIEWSTATE;
Problem je, ze to nenajde shodu. Pokud vezmu samostatne <input type=\"hidden\" name=\"__VIEWSTATE\" id=\"__VIEWSTATE\" value=\"([^\"]+)\" /> at jedno nebo druhe, tak to jede, ale ja potrebuju oba najednou... Za jakoukoliv radu predem diky.