Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8068679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:46:09+00:00 2026-06-05T12:46:09+00:00

I have a situation: my Java program deployed on a server fetches a page

  • 0

I have a situation: my Java program deployed on a server fetches a page from a website, which has a captcha image. The image will be displayed to the end-user and the end-user will enter the value of the captcha and submit that page to the server. The server will submit that value to the main website.

I have tried it using http client but on submitting, it says invalid image value.

Please help me.
code to show user capthca image

HttpClient hc=new HttpClient();
GetMethod gm=new GetMethod("https://abc.com/register");
int sta=hc.executeMethod(gm);
String line=gm.getResponseBodyAsString();

    urlStr="https://abc.com/captchaImage";
    URL url=new URL(urlStr);
    BufferedImage img1 = ImageIO.read(url);
    ImageIO.write(img1, "jpg", out);

submit requets to abc.com

HttpClient hc=new HttpClient();
PostMethod hm=new PostMethod("https://abc.com/submit");
hm.addParameter("pwd","Asdf@123456" );
hm.addParameter("confirmPwd","Asdf@123456");
hm.addParameter("hintQues","Birth+City");
hm.addParameter("hintAns","fdgf");
hm.addParameter("captchavalue",request.getParameter("cap"));
hm.addParameter("register","Register");
int returnCode = hc.executeMethod(hm);
out.println(hm.getResponseBodyAsString());
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:46:11+00:00Added an answer on June 5, 2026 at 12:46 pm

    I have not analyzed how abc.com’s registration work, but I would bet that it uses either some hidden field (for which I see no parameter in your code), or a cookie to remember which captcha was displayed to the user, and thus verify if the captcha value sent by the browser is the right value.

    Since you don’t send the hidden field value, and since you’re using a fresh new HttpClient instance, you’re sending a captcha value to the server, but it has no way to know for which captcha you’re sending this value, and so can’t verify it.

    Try reusing the same instance of HttpClient than the one used to get the registration page from the server. This way, cookies stored in the HttpClient’s state will be sent back to the server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Java for this program, and I currently have a situation where
I have a program which rescales images using the mortennobel image library for the
I have the following situation: Java lib class: class LibClass { ArrayList<LibClass> children; }
I have a situation where a Java Applet hangs after being opened multiple times.
I often have a situation in my Java code when I need to set
I have a situation where I want a Java client to have a two-way
I have a situation where i need to send commands to a running java
I have a situation where I have to write a client in Java against
Can any tell me how signals are handled in Java? I have a situation
I have the following situation. I have a HashMap in Java with keys as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.