Have checked the codes many times, looks all ok...
However, the remote side responds there's no value transmitted.
What's the wrong?
String mob = 'MOB';
String msg = 'MSG';
Http h = new Http();
HttpRequest req = new HttpRequest();
String url = 'http://www.w3schools.com/tags/demo_form_method_post.asp';
String bodyStr = 'fname='+mob+'&lname='+msg;
req.setEndpoint(url);
req.setMethod('POST');
req.setBody(bodyStr);
req.setCompressed(true);
HttpResponse res = h.send(req);
String retStr = res.getBody();
Reference:
http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_form_method_post
http://www.w3schools.com/tags/demo_form_method_post.asp