-5

sample code like this

curl https://r.catchoom.com/v1/search \

-F "token=aaaaaaa" \

-F "image=@cc.jpg"

I want to know how to translate them to java code?

Buffer
  • 81
  • 1
  • 7

1 Answers1

0

In curl -F means post the form data, usually the content type is multipart/form-data. You can use the Apache HttpClient library for this purpose in Java.

Here is an example of posting form using MultipartRequestEntity. Before looking into this example, I'll suggest you to try this example to be habituated with normal http POST.

Sabuj Hassan
  • 35,286
  • 11
  • 68
  • 78
  • Thanks for your advice! I test some websites successfully(post the form data use apache httpclient),but when i test website i mentioned in my question(https://r.catchoom.com/v1/search \) ,it response 400 error, i really don't know why??? api suggest here:http://catchoom.com/documentation/api/recognition/ – Buffer Mar 18 '14 at 13:30