I'm attempting to access selected data from the html table that is returned from http://reednavigation.com/lunars/lunars_v5.asp (full path works in browser and can be found in code below in the commented parameter Almanac_full).
I've tried replicating code seen elsewhere on stackoverflow for similar problems but can't get past the first Jsoup.connect().execute line. It always lands in my exception catch.
I am a relative novice at Android and Java, so any ideas (and as much tolerance as you can muster) will be greatly appreciated.
Thanks
Code:
try {
String Month= "August";
String Day = "9";
String Year = "2014";
String Almanac = "http://reednavigation.com/lunars/lunars_v5.asp";
//String Almanac_full = "http://reednavigation.com/lunars/lunars_v5.asp?BodySel=Include+Navigation+Stars&todaycheck=0&GMTmonth=August&GMTday=9&GMTyear=2014&gmtsel=Gr.+Mean+Time&hristep=Every+Hour°format=dd.dddd&usesha=on&OutType=N&LatDeg=&LatMin=&LatName=N&LonDeg=&LonMin=&LonName=W";
Response response1 = Jsoup.connect(Almanac).method(Connection.Method.GET)
.data("BodySel", "Include+Navigation+Stars")
.data("todaycheck", "0")
.data("GMTmonth", Month)
.data("GMTday", Day)
.data("GMTyear", Year)
.data("gmtsel", "Gr.+Mean+Time")
.data("hristep", "Every+Hour")
.data("degformat", "dd.dddd")
.data("usesha", "on")
.data("OutType", "N")
.data("LatDeg", "")
.data("LatMin", "")
.data("LatName", "N")
.data("LonDeg", "")
.data("LonMin", "")
.data("LonName", "W")
.timeout(10000)
.execute();
Map<String, String> cookies = response1.cookies(); //Get the session cookie
Document doc = Jsoup.connect(Almanac).method(Connection.Method.POST)
.data("BodySel", "Include+Navigation+Stars")
.data("todaycheck", "0")
.data("GMTmonth", Month)
.data("GMTday", Day)
.data("GMTyear", Year)
.data("gmtsel", "Gr.+Mean+Time")
.data("hristep", "Every+Hour")
.data("degformat", "dd.dddd")
.data("usesha", "on")
.data("OutType", "N")
.data("LatDeg", "")
.data("LatMin", "")
.data("LatName", "N")
.data("LonDeg", "")
.data("LonMin", "")
.data("LonName", "W")
.timeout(10000)
.cookies(cookies)
.post();
String title = doc.title();
Elements BodyElements = doc.getElementsContainingText(Body);
}
catch (Exception e) {
System.out.println("Error occured reading URL.");
OutputText.setText("Error occured reading URL.");
}