Blackberry send a HTTPPost request

后端 未结 5 1645
刺人心
刺人心 2020-12-18 10:53

i am developing and app for blackberry and i need to send a Http Post Request to my server. I\'m using the simulator in order to test my app and i found this code in order t

5条回答
  •  感情败类
    2020-12-18 11:28

    Here is a sample code on how to send a POST request:

    HttpConnection c = (HttpConnection) Connector.open(url, Connector.READ_WRITE);
    c.setRequestMethod(HttpConnection.POST);
    OutputStream os = c.openOutputStream();
    os.write(request.getBytes("UTF-8"));
    os.flush();
    os.close();
    InputStream is = c.openInputStream();
    

    Just make sure you use this code in a separate thread.

提交回复
热议问题