如何将验证码从网站添加到应用程序

how do I add captcha from a website to an app

我正在尝试构建一个可让您搜索火车预订详细信息的应用程序,网站上有一个验证码,我需要帮助将验证码添加到应用程序中。

基本上我想把这个页面变成一个应用程序:http://www.indianrail.gov.in/pnr_Enq.html

试试这个:

据我所知,你想要的是这部分

<img src="captcha_code_file.php?rand=&lt;?php echo rand(); ?&gt;" id="captchaimg">

现在你有了元素的 Id,使用 Jsoup:

Document doc = Jsoup.connect("http://www.indianrail.gov.in/pnr_Enq.html").get();
Elements imgCaptcha= doc.select("#captchaimg");
String imgSrc=imgCaptcha.attr("src");
Log.d(Tag,"image source = "+imgSrc);

现在创建流并从 imgSrc 下载它