Tuesday, November 25, 2014

Sending SMS Using PHP Via GSM Modem


     After I was able to send sms text message in Visual Basic 6 my intention to improve my skills and knowledge in programming does not stop there. My next plan is to write an application to send sms using PHP as my programming language. PHP is one of my favorite language I earned from it and it is easy to learned for beginners. After some research over the Internet I find a class code in PHP that enables us to send sms using a gsm modem. 

I modify the code to suit to my needs and then test using my gsm modem provided by Sun Broadband Internet. In my computer at home it runs on Windows XP the gsm modem uses communication port 3 for sending information specially sms messages. After some trial and error and refinement of my code I was able to send text messages from PHP into my mobile phone. 

My code works using globe tattoo, sun broadband internet and smart bro plugin gsm modem here in the Philippines. If you are trying to use my code in your country please check your telecommunication company about it. I hope you find my work useful and beneficial in your programming assignments and projects which involves integrating SMS functionality in your application. 

Questions and comments your can send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com. People here in the Philippines who wish to contact me can reach me in my mobile number 09173084360 and my telephone number at home at (034) 4335675. Thank you very much and Happy Programming.





Sample Output of Our Program



Check your GSM Modem here device manager to determine the communication port before you run the program




22 comments:

  1. Replies
    1. Good Day Sir Jake.. my error is
      Notice: Use of undefined constant ALL - assumed 'ALL' in C:\xampp\htdocs\trysms\send.php on line 13. i hope you notice and help me .. thank you

      Delete
    2. How about windows 10? will it work?

      Delete
  2. it gives the error

    Fatal error: Uncaught exception 'Exception' with message 'Unable to setup COM port, check it is correct' in D:\xamp\htdocs\smsgateway\gsm2\index3.php:60 Stack trace: #0 D:\xamp\htdocs\smsgateway\gsm2\index3.php(17): gsm_send_sms->init() #1 {main} thrown in D:\xamp\htdocs\smsgateway\gsm2\index3.php on line 60

    ReplyDelete
    Replies
    1. how did u fix this kind of error? can you please share please

      Delete
    2. make sure that you can query your modem first... Go to Device Manager>Your Modem>Diagnostic>Query Modem.
      If you got success on the query. Then the code might work as well. In my case it works, that how I did it.

      Delete
  3. Occurrence Of the Error Need High Assistance
    ( ! ) Fatal error: Uncaught exception 'Exception' with message 'Did not receive responce from modem' in C:\wamp\www\sms_sender\send.php on line 87
    ( ! ) Exception: Did not receive responce from modem in C:\wamp\www\sms_sender\send.php on line 87

    ReplyDelete
    Replies
    1. Hi! I have the same issue, may I know how to solve it?

      Delete
  4. Hello kababayan, meron error sa code, unknown port daw, i tried to chnage it according to my modem's port, pero wala ayaw pa rin

    ReplyDelete
    Replies
    1. pre! naghihintay rin ako ng solution! potik ng ilang oras debugging wla parin! wagh!

      Delete
    2. naayos niyo na po ba ang sainyo?

      Delete
  5. Does this code can receive sms in php and store it inside Mysql database?

    ReplyDelete
    Replies
    1. this code works for me. thank you for this. but I want my system to receive sms inside the system. can you please help me how can I integrate receiving sms functionality.

      Delete
    2. hi sir, gumana na po ba yung codes nyo? may error po kasi yung sakin. pwde po bang patulong?

      Delete
    3. Thank you John Mark this code works in sending sms but I was not able yet to implement receiving the sms from the receiver.

      Delete
    4. Thanks anyway.. I was able to pass my thesis because of this.😇

      Delete
  6. Notice: Use of undefined constant ALL - assumed 'ALL' in C:\xampp\htdocs\tally\send.php on line 13

    please help me sir an error displayed like this.

    ReplyDelete
  7. bro akala ko nalibot ko na buong google kakahanap andito kalang pala salamat haha

    ReplyDelete
  8. Your post is very interesting to read. Having a wish to send a text message directly from your own software, website or application is now gets possible. You can use our code of Bulk SMS API PHP for SMS notifications, signup messages, alert, reminder, and OTP.

    ReplyDelete
  9. Warning: Use of undefined constant ALL - assumed 'ALL' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\source\send.php on line 13

    ReplyDelete
  10. hello po working po ba ito sa sending bulk sms?

    ReplyDelete