Joke Collection Website - Blessing messages - I have a short message interface provided by mobile. How to call these interfaces to send short messages in php?

I have a short message interface provided by mobile. How to call these interfaces to send short messages in php?

What is the style of mobile phone interface? Is it soap or custom?

Calling a custom interface usually has the following steps:

1. Read the interface document.

2. The data interface usually provides some parameters. If it is a GET interface, please splice the parameters after the address (recommended

Http_build_query). If it is a POST interface, please see my sample code.

Step 3 request data

4. Parse the returned content and judge whether the call is successful. Usually, the content returned is in xml and json format.

Give you an example of CURL calling POST interface:

& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)

$ch? =? Curl_init ('omit the interface address,? Prevent shielding');

//? The following options are set to true, otherwise the content returned by the interface will be printed directly on the page.

curl_setopt($ch,? CURLOPT_RETURNTRANSFER,? True);

//? Connection timeout, be sure to set it.

curl_setopt($ch,? CURLOPT_CONNECTTIMEOUT,? 5); ?

//? After a successful connection, the request timed out, so it must be set.

curl_setopt($ch,? CURLOPT_TIMEOUT,? 5);

//? Use publish request

curl_setopt($ch,? CURLOPT_POST,? 1);

//? Release parameters,? $post_data is an associative array of parameters.

curl_setopt($ch,? CURLOPT_POSTFIELDS,? $ post _ data);

//? Submit a request and get feedback?

$ response? =? curl _ exec($ ch);

//? Analyze the content of the feedback. If it is SOAP style, please refer to the usage of SoapClient class in PHP document. Because the Soap specification is not uniform, Soap implemented in other languages may not be compatible with PHP.

I have used Monternet's interface before (not the mobile phone interface), which provides two styles of API. Its Soap is not compatible with PHP. So I chose a custom style API.