SMS development 1

xiaoxiao2021-03-06  66

There are two ways, as for SMS interface dealers (such as mobile, and other companies that use mobile interfaces), which interface is not necessarily

The first is HTTP mode

The second is a socket method

The first general use GET mode transmits information to SMS interface servers, such as http: // interface servers: Port /? Parameter name = ****, etc.

Because the SMS content is not allowed to exceed 70 Chinese characters, the get mode is sufficiently used.

The second only uses the socket method to connect, while other parameters have no difference with the get mode.

-------------------------------------------------- -------------

Specific processes, each provider may not be the same

Just remember, just submit the parameters to the interface server, you don't have to consider others.

There is a process is common

That is, after you submit the parameter information to the server, the server also uses one of two ways, returning the information to you.

For example, you tell the service provider in advance, give you a report address that correctly send SMS, http: // ourselves / file name

Then you submit information to the server. After they handle your information, you will do the address you tell to make you know whether the SMS is sent normally. Of course, you can also use the specified port to make reports with Socket mode.

-------------------------------------------------- -------------

SMS interfaces also have some third-party companies

If you use the company's interface, you have to pass the company's server, and finally send it to the mobile Unicom server.

-------------------------------------------------- -------------

I used to do it according to the provider. Can refer to it. Mainly Socket read

$ SMSUID = "xxx"; // SMS gateway assigned to your username and password

$ SMSPWD = "SMS";

$ SMSSOCKET = "192.168.1.1"; // SMS gateway IP 211.151.90.7

$ SMSPOST = 1081; // SMS gateway port

$ fp = @ fsockopen ($ SMSSOCKET, $ SMSPOST, & $ Errno, & $ Errstr, $ SMSTIMEOUT);

IF (! $ fp)

{

echo " Connection failed, see if it is correctly connected to the network! "; // Connection failed

}

Else

{

// Log in to SMS Center Server

FPUTS ($ FP, "Login / N");

FPUTS ($ FP, $ SMSUID. "/ n");

FPUTS ($ FP, $ SMSPWD. "/ n");

FPUTS ($ fp, "/ n");

$ MessageContent = TRIM ($ _ post ["messagecontent"]);

$ Mobileno = trim ($ _ post ["mobile [mobileeno"]);

$ ServiceEpe = "mffw"; // billing code 3 TP 0.5 Pixabay charge $ priority = "0"; // Send priority

$ Agentflag = "0"; // A charge of charge

$ MOFLAG = "2"; // Direction number

$ EviRetime = ""; // SMS failure time

$ Scheduletime = ""; // Time Send Time

$ Reportflag = "1"; // status report

$ status = "255"; // must return status report

$ MessageType = "text"; // SMS type text information

$ FREETERMINALNO = $ mobileno; // Trill mobile phone number

$ Targetterminalno = $ mobileno; // Receive party mobile number

$ SOURCETERMINALNO = $ mobileno; // Send a mobile phone number

$ MessageID = "123";

Print (fget ($ fp, 4096));

Print (fget ($ fp, 4096));

FPUTS ($ FP, "Submit". "/ n");

FPUTS ($ FP, $ MessageId. "/ n");

FPUTS ($ FP, $ FREETERMINALNO. "/ n");

FPUTS ($ FP, $ SOURCETERMINALNO. "/ n");

FPUTS ($ FP, $ TARGETTERMINALNO. "/ n");

FPUTS ($ FP, $ ServiceType. "/ n");

FPUTS ($ FP, $ MOFLAG. "/ n");

FPUTS ($ FP, $ REPORTFLAG. "/ n");

FPUTS ($ FP, $ EXPIRETIME. "/ n");

FPUTS ($ FP, $ SCHEDULETIME. "/ n");

FPUTS ($ FP, $ MessageType. "/ n");

$ MessageContent = STR_REPLACE ("/ R", ", STR_REPLACE (" / N ",", $ messagecontent)); // Can't have a carriage return FPUTS ($ fp, $ messagecontent. "/ N");

FPUTS ($ fp, "/ n");

Print ("
Send success!
". $ mobileno. ":". $ messagecontent;

Fclose ($ fp);

}

转载请注明原文地址:https://www.9cbs.com/read-89285.html

New Post(0)