PHP : Send SMS by smsgateway.com
<?php
function smsnotify($mobile_no,$msg,$sender) {
$user_id = "gatewayusername";
$passwd = "gatewaypassword";
$host = "api.smsgateway.com";<br />
$port = "80";<br />
$path = "/api_sms.jsp";
$data="user_id=$user_id&passwd=$passwd&sender=$sender&mobile_no=$mobile_no&msg=$msg";
$fp=@fsockopen($host,80);
if ( $fp) {
fputs($fp,"POST $path HTTP/1.1\r\n");
fputs($fp,"Host: $host\r\n");
fputs($fp,"Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp,"Content-length: ".strlen($data)."\r\n");
fputs($fp,"Connection: close\r\n\r\n");
fputs($fp,$data);
while(!feof($fp)) {
$buffer=fgets($fp,128);
}
fclose($fp);
}
}
$phonno='00000000';
$msg='This is a SMS message';
smsnotify($phonno,$msg,"SenderName");
?>
ปล. ยังไม่ได้ทดสอบนะจ๊ะ
ที่มา www.thaihosttalk.com
Relate topics
- nginx - ถึงเวลาซะที
- PHP PDO using
- การเก็บ JSON ใน MySQL ด้วย PHP
- macOS 12 Monterey: Web Server Setup/Apache/MariaDB/PHP Multiple Versions
- Ubuntu Server Installation
- Bug : isset($body['location']) ดันเป็นจริงเมื่อ $body ไม่ใช่ array
- MVC - แนวคิดเกี่ยวกับ MVC
- FTP chmod
- Hash & Salt
- Regular Expression - ยังไง ยังไง ก็ใช้ไม่ถูกสักที
- PHP : How to show Adsense on web
- Directadmin PHP path
- Application Programming Interface (API)
- IP Camera snapshot
- Enable Exif
- Make Ubuntu to be a web server (LAMP)
- SELECT - OnChange
- Class fpdf กับภาษาไทย
- มาแล้ว PHP 5.3 พร้อมกับ error ที่ไม่คาดฝัน
- Hello Twetter from SoftGanz