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

  • Home
  • SEARCH
  • 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 8229205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:43:18+00:00 2026-06-07T16:43:18+00:00

I am trying to make a post request on this page http://www2.gcitrading.com/quotes/converter.asp , but

  • 0

I am trying to make a post request on this page http://www2.gcitrading.com/quotes/converter.asp,
but its not working..I still get the same page after my post request (without the result).

When I use the browser, after I click convert the page turns to http://www2.gcitrading.com/quotes/converter.asp?lang= Im really confused with this one. How can I make this work?

Here is my code:

public static void main(String[] args) {
    Socket sock = new Socket();
    InputStream in;
    OutputStream out;
    byte[] readBuffer = new byte[4096];

    String res = "";
        try {
        sock.connect(new InetSocketAddress("www2.gcitrading.com", 80));

        in = sock.getInputStream();
        out = sock.getOutputStream();

        out.write(new String("GET /quotes/converter.asp HTTP/1.1\r\n").getBytes());
        out.write(new String("Host: www2.gcitrading.com\r\n\r\n").getBytes());

        while(true) {
            int readSize = in.read(readBuffer);
            if(readSize < 1)
                break;
            res += new String(readBuffer, 0, readSize);
            if(res.contains("</html>"))
                break;
        }

        String cookie = res.substring(res.indexOf("kie:") + 5,res.indexOf("path=/")+6);
        System.out.println("SHow cookie - " + cookie);

        String convert_this = URLEncoder.encode("form_amount=1&form_from_currency=DZD&form_to_currency=USD", "UTF-8");

        out.write(new String("POST /quotes/converter.asp?lang= HTTP/1.1\r\n").getBytes());
        out.write(new String("Host: www2.gcitrading.com\r\n").getBytes());

        out.write(new String("Content-Length: " + convert_this.length() + "\r\n").getBytes());
        out.write(new String("Content-Type: application/x-www-form-urlencoded\r\n").getBytes());
        out.write(new String("Cookie: " + cookie +"\r\n").getBytes());
        out.write(new String("\r\n").getBytes());
        out.write(convert_this.getBytes());

        readBuffer = new byte[4096];
        res = "";

        while(true) {
            int readSize = in.read(readBuffer);
            if(readSize < 1)
                break;
            res += new String(readBuffer, 0, readSize);
            if(res.contains("</html>"))
                break;
        }

        System.out.println(res);


        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
}

Thanks. Btw, I need to achieve this using c/c++ sockets, but I tested it using java first.

  • 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-07T16:43:19+00:00Added an answer on June 7, 2026 at 4:43 pm

    It’s solved. I used Charles, it’s a web debugging tool, and found out that my post request is lacking. I simply added in my post request : convert_it=true

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

Sidebar

Related Questions

I'm trying to make this: 174,myfilename.jpg Into this on the php post process page:
So I'm using this plugin: jquery-in-place-editor , I'm trying to make a POST request
i'm trying to make an Ajax call but its causing page load Here is
I'm trying to send a POST request to a PHP script (http://mywebsite/index/test/ in this
Okay, so I'm trying to make this bigger: Post: <input id=postbox type=text rows=6 cols=40
I'm trying to make a simple HTTP post a endpoint with ONLY url arguments.
I'm trying to use Zend_Http_Client to make a simple post request on a site
I'm trying to make a multi-file upload. with help from this blog , but
I have been trying to make wall post from multiple pages but when i
I'm trying to post an array using a POST request to a specific page,

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.