public static long GetWorldTime() { try { WebClientX client = new WebClientX(); String content = client.GetMethod("http://www.unixtimestamp.com/index.php"); content = Utilities.SimpleRegexSingle("<font color=\"#CC0000\">([^<]*)</font>", content, 1); return Long.parseLong(content); } catch (Exception ex) { // ex.printStackTrace(); return 0; } }
public static String OnlineCaptchaSolving(String filename) { WebClientX client = new WebClientX(); Vector<NameValuePair> prs = new Vector<NameValuePair>(); prs.add(new BasicNameValuePair("i2ocr_options", "file")); prs.add(new BasicNameValuePair("i2ocr_url", "http://")); prs.add(new BasicNameValuePair("i2ocr_languages", "gb")); Vector<PostFileData> files = new Vector<PostFileData>(); files.add( new PostFileData("i2ocr_uploadedfile", "/Users/hoangong/projects/Java/Bet/" + filename)); String content = client.PostMethod("http://www.sciweavers.org/process_form_i2ocr", prs, files); content = Utilities.SimpleRegexSingle( "#ocrTextBox\"\\).val\\(\"(.*?)(?=\"\\);\\$\\(\"#ocrTextBox\")", content, 1); return ""; }