简体   繁体   中英

Java code for curl request

I'm desperate to find answer myself so I need external help.

Need a java code, which done exactly this: curl --data "username=&password=&submit=Login" -v

This is POST request to URL with data, which returns HEADERs, both sent and received.

Please advise! Thanks in advance!

Try this:

Process p = Runtime.getRuntime().exec( //
    new String[] { //
    //
      "curl", //
      "--data", //
      "username=&password=&submit=Login" //
});

This below will call the curl tool and passing it the following parameters: username=&password=&submit=Login .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM