SMS sender script

Hi all
Need a script to send SMS with next step:

  1. registration
  2. sending checking code to mobile phone and write in database
  3. autorization with cheking code and welcome messages

if that met or have similar scripts, please share. Thanks