Methods and example codes for sending AT commands in PHP

墨辰丷
Release: 2023-03-29 12:12:01
Original
1509 people have browsed it

This article mainly introduces the relevant information about the example code of PHP sending AT command. It is very good and has reference value. Friends who need it can take a look.

Requirement:Send SMS to The user enters his mobile phone and is required to customize the message content

Problem:There is no telecom mode, and the free api interface cannot be used to customize the text message content

Solution:Connect to the server through a 4G network card, operate the network card through AT commands, and send text messages

After checking, it was found that AT quality sending requires multiple encoding of the information, and the sending times out. , but the actual sending was successful, the problem has not been completely solved

The code is as follows:

 ) { //两个字节的文字 $str .= base_convert(ord($c), , ) . str_pad(base_convert(ord($c), , ), , , STR_PAD_LEFT); } else { $str .= str_pad(base_convert(ord($c), , ), , , STR_PAD_LEFT); } } $str = strtoupper($str); //转换为大写 return $str; } function get_message_length($phone, $message) { $str = 'D' . $phone . '' . $message; $length = strlen($str) / ; if ($length < ) { $length = '' . $length; } return $length; }
Copy after login

Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.

Related recommendations:

PHP Learning Record Array Function

PHP Implementation of Exporting Styled Excel Example Sharing

PHP implements the method of forcing the specified callback type based on Callable

The above is the detailed content of Methods and example codes for sending AT commands in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!