简体   繁体   中英

Web application send sms from my mobile phone?

I am from Romania and I am developing PHP Application for 1 year. I want to build now a web application that sends sms from web using my phone number. When the sms is send from the web, my sim card will be activated and will send that sms from my phone. Can you tell me please where to start with this? Thank you!

If you are using android you could use the ADB Driver, from the console you can run this (obviously with your phone connected) and send the SMS.

adb shell am start -a android.intent.action.SENDTO -d sms:CCXXXXXXXXXX --es sms_body "SMS BODY GOES HERE" --ez exit_on_sent true
adb shell input keyevent 22
adb shell input keyevent 66

You can save this in a script and then be called via PHP shell_exec () function through there and integrate everything you want to do.

Warning: extreme elegance ahead.

If you want to be able to send SMS from PHP by using code as simple as:

mail('0981234567@catchall.domain.com', '', 'SMS Message here'); // PHP

then you can immediately go to: https://github.com/evorion/SMSGateway

It's just incredibly easy to use and even works when your phone is not online the whole time.

If your machine and android device are in same network you can try this

PHP side

$client = new SMSClient();

try{

$exampleIP = "10.0.0.1";
$examplePort = 1234;

$client->connectToSMSServer($exampleIP, $examplePort);

}catch(Exception $e)
{
    echo "error! ".$e->getMessage();
    die();
}

$exampleMobileNo = "123456789"; // mobile phone no
$exampleMessage = "hello...";   // text message

//Make sure to validate Mobile No using regular expression. If invalid mobilePhoneNo then do other stuff


//If phone no is OK then 
$client->setMobileNo($exampleMobileNo);
$client->setSmsText($exampleMessage);
$error = $client->send();

Android side

SMSServer smsServer = new SMSServer(getApplicationContext(),1234);

//To start
smsServer.start();
..
..
..
//To stop
smsServer.stopSMSServer();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM