Heim > php教程 > php手册 > Hauptteil

php 发送sms实例代码

WBOY
Freigeben: 2016-06-13 11:22:58
Original
912 Leute haben es durchsucht



SMS Web Sender Demo


SMS Web Sender DEMO!

if ($action != "submit") {
?>

Any username or password you enter here will not be stored
 in any way (although we're not using SSL either)

Also, as you can see most of these are UK sites, not all
of them will support international numbers!


 
   
     
     
   
   
     
     
   
   
     
     
   
   
     
     
   
   
     
     
   
   
     
     
   
   
     
     
   
   
     
     
   
 
Site
       
     
User
       
     
Password
       
     
Number
       
        (eg. +447123123123)
Message
       
     
Debug
       
     
   
 
    
       
     

} else {

 // contains the site details
 include("sites.php");

 // contains main class
 include("class.sms_web_sender.php");

 if (empty($number) || empty($site) || empty($message)) {
  die("Make sure number, site and message are not empty");
 }

 if (!empty($debug) && $debug == "yes") {
  $debug = true;
 } else {
  $debug = false;
 }

 // signature bit of text that's required by some
 // sites like MTNSMS.com, you can leave as is
 $signature = "*";

 // create instance of sms web sender the one
 // optional argument will determine if
 // debug is turned on or not
 $sms = new sms_web_sender($debug);

 // add accounts
 // 1st argument: username
 // 2nd argument: password
 // 3rd argument: server
 // 4th argument: weight (this is only useful when
 //               shuffling the logins, the higher
 //               the weight, the more likely it'll
 //               be placed near the top of the list)
 //               default if left blank: 1
 $sms->add_login("$user", "$pass", "$site");

 // add Proxy Server details if required
 // I haven't tested this myself, feature of jm_sms
 //$sms->setProxyServer("proxyserver");
 //$sms->setProxyPort(81);
 //$sms->setProxyUser("proxyusername");
 //$sms->setProxyPass("proxypassword");
 //$sms->setProxy(true);

 // passes the number, signature and message in an array
 $result = $sms->send_sms(array("number"=>$number, "signature"=>$signature, "message"=>$message));

 if ($result) {
  echo "

Sent!

";
 } else {
  echo "

Could not send :(

";
  echo "

Go Back

";
 }

}

?>



Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Empfehlungen
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage