Joke Collection Website - Blessing messages - How to send and receive short messages in Java

How to send and receive short messages in Java

Using Java to send and receive short messages

/**?

*? @ Author? Deng Siming?

*? @ Date? 20 12-9- 18?

*?

*/?

Parcel? com . dengsilinming . mail; ?

Import? Java . io . io exception; ?

Import? org . Apache . commons . "); ?

//? Ex post facto method? Post? =? New? post method("/web _ API/"); ?

post . addrequestheader(" Content-Type ",

“application/x-www-form-urlencoded; charset = gbk "); //? Set transcoding in the header file?

NameValuePair[]? Data? =? {? New? NameValuePair("Uid ",Deng Siming),//? Register a user name?

New? NameValuePair("Key "," 72da78da5ff54f450505 "),//? After successful registration, the key obtained after logging in to the website?

New? NameValuePair("smsMob "," 12345678900"),//? Mobile phone number?

New? NameValuePair("smsText ")," This information is specially used for testing. Can you send text messages normally? " )? }; //? Text message content?

Post.setRequestBody (data); ?

client . execute method(post); ?

Header []? Title? =? post . getresponseheaders(); ?

int? statusCode? =? post . getstatuscode(); ?

System.out.println("statusCode:"? +? status code); ?

For what? (Header? h? :? Title)? {?

System.out.println(" -"? +? h . tostring()); ?

}?

String? The result? =? New? string(post . getresponsebodyasstring()。 getBytes(?

“gbk”)); ?

System.out.println (result); ?

}?

}