⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 receiver.php

📁 PHP写的单纯的点对点短信发送接收程序
💻 PHP
字号:
<?php
//for reading pending SMS you must frequently call this script. Use crontab job for example.
ob_start();
//print "<pre>";
require_once "../smpp.php";//SMPP protocol
//connect to the smpp server
$tx=new SMPP('localhost',2000);
//$tx->debug=true;

//bind the receiver
$tx->system_type="WWW";
$tx->addr_npi=1;
$tx->bindReceiver("login","password");
do{
	//read incoming sms
	$sms=$tx->readSMS();
	//check sms data
	if($sms && !empty($sms['source_addr']) && !empty($sms['destination_addr']) && !empty($sms['short_message'])){
		//send sms for processing in smsadv
		$from=$sms['source_addr'];
		$to=$sms['destination_addr'];
		$message=$sms['short_message'];
	    //run some processing function for incomming sms
	    process_message($from,$to,$message);
	}
//until we have sms in queue
}while($sms);
//close the smpp connection
$tx->close();
unset($tx);
//clean any output
ob_end_clean();
//print "</pre>";

function process_message($from,$to,$message){
	print "Received SMS\nFrom: $from\nTo:   $to\nMsg:  $message";
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -