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 9097285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:04:17+00:00 2026-06-17T00:04:17+00:00

i had some difficulties in programming and the meaning of the Request Body is

  • 0

i had some difficulties in programming and the meaning of the Request Body is confused. It always returns 400 response codes.Please help me.

 String baseURL="https://sb-ssl.google.com/safebrowsing/api/lookup";

 String arguments = "";
 arguments+=URLEncoder.encode("client", "UTF-8")+"="+URLEncoder.encode("demo-app", "UTF-8")+"&";
 arguments+=URLEncoder.encode("apikey", "UTF-8")+"="+URLEncoder.encode("apikey", "UTF-8")+"&";
 arguments+=URLEncoder.encode("appver", "UTF-8")+"="+URLEncoder.encode("1.5.2", "UTF-8")+"&";
 arguments+=URLEncoder.encode("pver", "UTF-8")+"="+URLEncoder.encode("3.0", "UTF-8")+"&";
 arguments+=URLEncoder.encode("post_req_body", "UTF-8")+"="+URLEncoder.encode("2\nhttp://www.google.com\nhttp://www.facebook.com", "UTF-8");

 String query = arguments;

    System.out.println("Sending POST request - " + query);
// Construct the url object representing cgi script
    URL url = new URL( baseURL );

    // Get a URLConnection object, to write to POST method
    URLConnection connect = url.openConnection();

    // Specify connection settings
    connect.setDoInput(true);
    connect.setDoOutput(true);

// Get an output stream for writing
    OutputStream output = connect.getOutputStream();


    PrintStream pout = new PrintStream (output);

    pout.print ( query );
    pout.close();
  • 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-17T00:04:19+00:00Added an answer on June 17, 2026 at 12:04 am

    Your request is wrong. If you use a POST request, then the parameters client, apikey, apiver and pver should be part of the URL.

    The request body should only consist of the URLs to check (plus the number of URLS on the first line).

    So it could look like this:

    String baseURL="https://sb-ssl.google.com/safebrowsing/api/lookup";
    
    String arguments = "";
    arguments + =URLEncoder.encode("client", "UTF-8") + "=" + URLEncoder.encode("myapp", "UTF-8") + "&";
    arguments + =URLEncoder.encode("apikey", "UTF-8") + "=" + URLEncoder.encode("12341234", "UTF-8") + "&";
    arguments + =URLEncoder.encode("appver", "UTF-8") + "=" + URLEncoder.encode("1.5.2", "UTF-8") + "&";
    arguments + =URLEncoder.encode("pver", "UTF-8") + "=" + URLEncoder.encode("3.0", "UTF-8");
    
    // Construct the url object representing cgi script
    URL url = new URL(baseURL + "?" + arguments);
    
    // Get a URLConnection object, to write to POST method
    URLConnection connect = url.openConnection();
    
    // Specify connection settings
    connect.setDoInput(true);
    connect.setDoOutput(true);
    
    // Get an output stream for writing
    OutputStream output = connect.getOutputStream();
    PrintStream pout = new PrintStream (output);
    pout.print("2");
    pout.println();
    pout.print("http://www.google.com");
    pout.println();
    pout.print("http://www.facebook.com");
    pout.close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I always had some difficulties to find a good way for the instant location
I had some issues with Lucene as it always had a constant score and
I had some help in another thread about having an issue with pulling data
I had some help today with a need and this is what I have
Had some strange errors, described here: lost in deployment: session.getAttribute() returns NULL in some
I had some trouble descriping this problem. Please feel free to change the title
I have had some difficulties in using extended classes in rails, in particular extending
I had some code that constructed an object: function gridObjConst(id, itemName, itemPrice, itemListPrice, width,
we had some demands here in my job that include working with asp. We
I had some issues with XPTemplate vim plugin. Sometimes it yields with errors, and

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.