Http Post With Body

前端 未结 5 405
轻奢々
轻奢々 2020-12-13 15:36

i have sent method in objective-c of sending http post and in the body i put a string:

NSString *requestBody = [NSString stringWithFormat:@\"mystring\"];
NSM         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 16:28

    You can try something like this using HttpClient and HttpPost:

    List params = new ArrayList();
    params.add(new BasicNameValuePair("mystring", "value_of_my_string"));
    // etc...
    
    // Post data to the server
    HttpPost httppost = new HttpPost("http://...");
    httppost.setEntity(new UrlEncodedFormEntity(params));
    
    HttpClient httpclient = new DefaultHttpClient();
    HttpResponse httpResponse = httpclient.execute(httppost);
    

提交回复
热议问题