Send SMS Messages using PHP

Поделиться
HTML-код
  • Опубликовано: 6 июн 2024
  • In this short PHP project, you'll learn how to send an SMS message to a mobile phone / cellphone using PHP.
    We'll use two SMS gateway providers, Infobip and Twilio, in order to compare how they work.
    All source code shown is free to download.
    Please consider supporting my channel:
    ☕ ko-fi.com/davehollingworth
    Code shown in the video:
    ‣ gist.github.com/daveh/6a31d0d...
    Links shown in the video:
    ‣ www.infobip.com/
    ‣ www.twilio.com/
    PHP packages:
    ‣ github.com/infobip/infobip-ap...
    ‣ github.com/twilio/twilio-php
    Videos:
    ‣ Securely Storing PHP Configuration Settings: • Securely Storing PHP C...
    00:00 Introduction
    00:14 SMS Gateways
    00:54 HTML Form
    01:29 Sending Script
    01:53 Infobip
    05:11 Custom sender ID
    06:06 Twilio
    08:44 SMS character limit
    09:45 Summary
    #PHP #sms #project
  • НаукаНаука

Комментарии • 79

  • @collenzaligway4458
    @collenzaligway4458 8 месяцев назад +1

    This is a very informative video, thank you so much Dave hope you keep making more.

  • @fadelellaherrami8840
    @fadelellaherrami8840 Месяц назад +1

    Dave, thank you very much for clarifying the video. Your explanation was really helpful

  • @jarencefeliciano
    @jarencefeliciano 8 месяцев назад +2

    Hi, Dave. Thank you for another short and concise tutorial. Best PHP instructor!

    • @someutubchannel69
      @someutubchannel69 8 месяцев назад

      I have 2 courses from him on Udemy.... best $$$ invested!!!

    • @jarencefeliciano
      @jarencefeliciano 8 месяцев назад

      @@someutubchannel69 I have 6 courses from him on Udemy too and 4 out of those courses are completed. Yes, $$$ invested!

  • @iam.masoudsamimi
    @iam.masoudsamimi 10 дней назад

    Awesome as always. Much appreciated.

  • @techatival
    @techatival 8 месяцев назад +2

    This is a useful video, thank you!

  • @abbasmohamedwalaal5753
    @abbasmohamedwalaal5753 8 месяцев назад +2

    Great video and nice explanation

  • @mounir101
    @mounir101 8 месяцев назад +2

    Thanks so much for this unique lesson. Please could you make a another lesson about how to create a REST API using slimPHP framework. Keep going.

  • @batchrocketproject4720
    @batchrocketproject4720 8 месяцев назад +1

    very useful, thanks. 💯

  • @aogunnaike
    @aogunnaike 8 месяцев назад +2

    Thanks alot for this

  • @nameoftruth
    @nameoftruth 8 месяцев назад +1

    Thank you very much boss...

  • @prepayt3637
    @prepayt3637 6 месяцев назад

    thankyou so much so helpful

  • @someutubchannel69
    @someutubchannel69 8 месяцев назад +3

    Dave,
    Hi! ! Amazing video as always!
    Do you have a video about how to properly use composer ?
    If not, would you please create one about it?
    As always... Thank You!!!

    • @dave-hollingworth
      @dave-hollingworth  8 месяцев назад +1

      I don't at the moment, but it's a good idea for a video, I'll make a note!

    • @someutubchannel69
      @someutubchannel69 8 месяцев назад +1

      @@dave-hollingworth
      Thank You so much!!!

  • @Linksdapp
    @Linksdapp 8 месяцев назад

    I love your videos, have code a multi vendor frontend website, but i don't know backend programming to connect the frontend to the backend, I really wish you could do a video on it. I love your tutorials so easy to understand. I will be happy if you can be mentor in programming. Am Moses

  • @dave-hollingworth
    @dave-hollingworth  8 месяцев назад

    Source code is available here: gist.github.com/daveh/6a31d0d28d9aef8c161c6ff1b6d29fae

    • @pitularjelldaenuelc.557
      @pitularjelldaenuelc.557 2 месяца назад

      how do i fix this?
      Fatal error: Uncaught Error: Class "Twilio\Rest\Client" not found...

    • @dave-hollingworth
      @dave-hollingworth  2 месяца назад

      @@pitularjelldaenuelc.557 Make sure you've installed the packages using Composer, and included Composer's autoloader

  • @manosxa
    @manosxa 4 месяца назад

    Maybe is a stupid question or something obvious for all however I need to know where do we run the $ composer...... .Is it in the windows command by altering the location to the root of the project? It does not look like you have any location on your screen when you run it.

    • @dave-hollingworth
      @dave-hollingworth  4 месяца назад

      Ah sorry didn't see this comment - yes, it's on the command line, using cd to change to the project folder. As @StoryTellerZb says though, you can do it from inside VSCode if you prefer

  • @misternley
    @misternley 8 месяцев назад

    Hi Dave thank you for this video. Now let's say you want to send SMSes in bulk to different recipients. For example in a school sending fees balances. The balances being fetched from a different table from the one having the phone numbers and names. By using a loop e.g foreach, do..while e.t.c the code takes a longer time to execute and therefore taking more server resources, how can one achieve the former without the latter problem.

    • @dave-hollingworth
      @dave-hollingworth  8 месяцев назад +2

      Depending on which provider you're using, you could send several messages with one call if you build up the list of messages first. Also, with things like this, you could run it as a scheduled task when load is low on your server (e.g. at night)

  • @heshankanishka8316
    @heshankanishka8316 3 месяца назад

    Sir, please tell me about the WhatsApp business api

  • @cyriljimrylgana3243
    @cyriljimrylgana3243 Месяц назад

    hi sir can you make a video that can send multiple phone numbers using those 2 api

  • @user-yr8jw4hm7t
    @user-yr8jw4hm7t 3 месяца назад

    Hello, do you have another platform you can be contacted on need help!

  • @terrybus1
    @terrybus1 4 месяца назад

    Hello Dave, this video on php sms is great, however I.m having an issue with the line..."$configuration = new Configuration(host: $base_url apiKey: $api_key);" The error is Syntax error, unexpected ':' , expecting ',' or ')'

    • @dave-hollingworth
      @dave-hollingworth  4 месяца назад

      This is because you're using an older version of PHP that doesn't support named arguments. You can upgrade PHP (recommended) or remove the argument names (the "host:" etc. parts)

  • @Iamstephane
    @Iamstephane 2 месяца назад

    Hev Dave. Please how do I fix this error "Uncaught Error: Class "infobip\Configuration" not found" ?

    • @dave-hollingworth
      @dave-hollingworth  2 месяца назад

      Make sure you've installed the packages using Composer, and included Composer's autoloader

  • @louiscastle9448
    @louiscastle9448 3 месяца назад

    So i will put some code for twilio and the admin/user should download twilio too for them to receive the message?

    • @dave-hollingworth
      @dave-hollingworth  3 месяца назад

      No, once the message is sent, all the recipient needs is a mobile number

  • @PraveenaL-kp6lk
    @PraveenaL-kp6lk 2 месяца назад +2

    SMS message sent in my site but didn't receive to my mobile

  • @olatunjipelumi4671
    @olatunjipelumi4671 6 месяцев назад

    Please how do i make the reciever to see the message coming from me as the sender rather than seeing rather Infobip as the sender

    • @dave-hollingworth
      @dave-hollingworth  6 месяцев назад

      ruclips.net/video/obolAwbx388/видео.htmlsi=sSmnnJuU3CLS-jeT&t=312

  • @Crank-nn2ub
    @Crank-nn2ub 22 дня назад

    Dave excuse my lack of intelligence but please can you kindly explain what your using exactly to write the code? Is that a program? Is that a OS?

    • @dave-hollingworth
      @dave-hollingworth  21 день назад

      It's a code editor, Visual Studio Code. It's free, you can get it here: code.visualstudio.com/

    • @Crank-nn2ub
      @Crank-nn2ub 21 день назад

      @@dave-hollingworth Dave, I have spent the last two days studying this video. I have followed every single step and done this multiple times. I’m still having a silly error encountered on my side. I’m surely making a small mistake but I can’t seem to figure out where.
      Please take my request seriously I am more than happy to pay you upfront for a quick 10 or 15 minutes chat. Maybe you can help me where I am going wrong…..
      I will pay you upfront, so you know I am not messing around please can you reply to this comment with a handle i can contact you on such as telegram or whatever you prefer.
      Sir, I know you get a lot of comments on your videos of people asking you for help but hopefully you’re happy to help me where I am willing to pay for your time. I will pay first so you know I’m serious. Any crypto you like :)

  • @Tenku97
    @Tenku97 4 месяца назад

    how to solve Parse error: syntax error, unexpected ':', expecting ') in $configuration?

    • @dave-hollingworth
      @dave-hollingworth  4 месяца назад

      Probably because of named arguments - remove the names or upgrade your PHP version

  • @pitularjelldaenuelc.557
    @pitularjelldaenuelc.557 2 месяца назад

    how do i fix this?
    Fatal error: Uncaught Error: Class "Twilio\Rest\Client" not found...

    • @dave-hollingworth
      @dave-hollingworth  2 месяца назад

      Make sure you've installed the packages using Composer, and included Composer's autoloader

  • @salakopaul8755
    @salakopaul8755 4 месяца назад

    Thank you for this great video, My Info worked but for TWILO i'm having issues at the $twilio_number = "+ "; area, i dont know hwere to get the number to input there
    And for INFO, how can i send to more than one contacts?

    • @dave-hollingworth
      @dave-hollingworth  4 месяца назад

      The number is in the Twilio console, where there are also code samples to do different things

  • @stanleyuche8272
    @stanleyuche8272 8 дней назад

    your video is simplified thank you so much but am finding it hard to upgrade my twillio account. please kindly assist

    • @dave-hollingworth
      @dave-hollingworth  7 дней назад

      Please try contacting Twilio support for help with those accounts

  • @ShrikrupaMedia
    @ShrikrupaMedia 2 месяца назад

    In command prompt i got eeror composer not recognised

    • @Iamstephane
      @Iamstephane 2 месяца назад

      You have to first manually download the composer package from google and install on your PC before you'll be able to use composer in terminal

  • @abdelhamidnehlil7277
    @abdelhamidnehlil7277 8 месяцев назад

    merci khoo #khoo = frère

  • @user-rb2ix9vr9s
    @user-rb2ix9vr9s 7 месяцев назад

    Master, good afternoon, i make all steps, fisrt time from install using composer and after i try to copy directly two projects, but not work. Can i send my code by mail to helpme please??? i need that this work to a litlle web project

  • @calvinmubata1831
    @calvinmubata1831 5 месяцев назад +1

    On $configuration its giving an error, unexpected ':', expecting ')😇'

    • @Tenku97
      @Tenku97 4 месяца назад

      how to fix this?

  • @drumbeatsnation1563
    @drumbeatsnation1563 7 месяцев назад

    will it still works in localhost when i use free or i buy subscription?

    • @dave-hollingworth
      @dave-hollingworth  7 месяцев назад +1

      Yes it will still work on localhost

    • @drumbeatsnation1563
      @drumbeatsnation1563 7 месяцев назад

      @@dave-hollingworth i tried the free version of twilio, it has logs in my message log in twillio account and says its delivered but i didn't receive any message in my phone number until now, i use php.. can you help me why?

  • @edwardklem7718
    @edwardklem7718 6 месяцев назад

    Its saying message sent but not seeing anything on my phone. No received messages

    • @dave-hollingworth
      @dave-hollingworth  6 месяцев назад

      Check the logs in the provider's dashboard, see if it says anything there

  • @BahasictTv
    @BahasictTv 7 месяцев назад

    I try it on my server but not working ( This page isn't working...)😢

  • @terrybus1
    @terrybus1 4 месяца назад

    i am using php 8.2...am i missing something?

    • @dave-hollingworth
      @dave-hollingworth  4 месяца назад

      If it works when you remove the argument names, then it would seem that your web server is using an earlier version of PHP (it's possible that you could have several versions installed, or the command-line version is different to the web server version)

  • @miraclemissionmw
    @miraclemissionmw 3 месяца назад

    Im getting an error that says class infobip\api\smsApi not found , how can i best fix this

    • @dave-hollingworth
      @dave-hollingworth  3 месяца назад

      Check you're including Composer's autoloader, and that the namespaces and classnames have the correct case

    • @miraclemissionmw
      @miraclemissionmw 3 месяца назад

      @@dave-hollingworth solved thanks, thou I can't add multiple recipients for the number under infobip as it only allow me to register one recipient
      Great tutorial by the way 👏

    • @Iamstephane
      @Iamstephane 2 месяца назад

      Bro please how did you fix this error "Uncaught Error: Class "infobip\Configuration" not found"? I get it when using infobip@@miraclemissionmw

  • @user93464
    @user93464 8 месяцев назад

    How to sent message on Viber and WhatsApp?

    • @dave-hollingworth
      @dave-hollingworth  8 месяцев назад +1

      Both providers shown in the video have an API for WhatsApp, check out their websites for more details

    • @user93464
      @user93464 8 месяцев назад +1

      @@dave-hollingworth Thank you!

  • @YoutubeP-vn1de
    @YoutubeP-vn1de Месяц назад

    Can you help me bro to fix my script I will pay for it bro it’s important for me

    • @dave-hollingworth
      @dave-hollingworth  Месяц назад

      I'm afraid I don't do any consulting work at the moment, but if it's a simple question please feel free to post the details and I'll have a look

    • @YoutubeP-vn1de
      @YoutubeP-vn1de Месяц назад

      @@dave-hollingworth it’s very simple sir for you I have scripts you just need to edit something and it’s important for me I will be happy if you help me the problem is script not showing anything it’s blank after host same script working befor but suddenly I don’t know what happened started showing blank page
      Please can share me your Instagram telegram or mail anything so I can send you files so you can check

  • @wellkin
    @wellkin 7 месяцев назад

    Is that free?

    • @dave-hollingworth
      @dave-hollingworth  7 месяцев назад

      Both providers give you a few messages for free when you create an account, but generally sending SMS messages costs per message.