Tyluur
Tyluur

Reputation: 95

Get image for captcha session

I want to get the current captcha that is displayed on a website. An example of this would be http://top100arena.com/in.asp?id=58978

How would I get the image link of the captcha that is displayed other than right clicking - > open image in new page?

Upvotes: 2

Views: 4317

Answers (2)

Daniel F Jaramillo
Daniel F Jaramillo

Reputation: 1

Try using Firebug in firefox https://addons.mozilla.org/es/firefox/addon/firebug/, Its easy to use and in the Red section you´ll find a label named Image, you´ll find the image there.

Upvotes: 0

Martijn Courteaux
Martijn Courteaux

Reputation: 68847

You are looking for the div identified by "rechapta_image": enter image description here

Then extract the src attribute of the img element inside this div.

To do this, you can choose for an easy String-operation-based way or use a HTML parsing library like JSoup.

Here is an example of such an extract URL:

http://www.google.com/recaptcha/api/image?c=03AHJ_VutGj3wvhGoQGxu6FUnG3uOWJdyB2RpSb2N5v9AQJyakMy1kKMPeDoRfADhjAj5rLqekuOzXe3cRChnA_sEN7PL68em4pI_kE3wFKUhhkqFF9jQzKJerX__InwD_DB0Ox1mKQmZVRl97yuSL62tZhYyhSqtuIta-3n0KvytB9QqSn8nXgw8


Actually, it seems that the chapta box is an iframe. So search for an iframe with src string containing "chapta". Example of such a iframe:

<iframe src="http://www.google.com/recaptcha/api/noscriptk=6LeyFroSAAAAAJTmR7CLZ5an7pcsS5eJ3wEoWHhJ"
   height="300" width="500" frameborder="0"></iframe><br/>

So, once you extracted that URL, use JSoup again to find the URL to the image. The page fetched has a part this:

enter image description here

So, look for a center element, and get the img element out of it.

Upvotes: 1

Related Questions