Hey, so like me you want the ability to do more with ARMA but C++ is not one of your favorite languages, here is a small tutorial on how to write a working ARMA DLL completely in C# (and other .NET languages I presume), no need for C++/CLR or ARMA2NET.
Category: Tutorial
Starting out with PHP – Part 1
These days I’m finding that there are a lot of people ‘writing’ PHP. The problem is quite a lot of these people think they’re qualify as a developer after producing a couple of simple sites.
So I’m going to give some advice on things you can do to improve your skills.
Bootstrap Alerts
Here is a quick alert’s replacement to use with Bootstrap and JQuery.
What it does is replace the horrible alert dialogs built into browsers with Bootstrap styled alerts. The result is:
Click here for a demo and here to download
Send an SMS in FuelPHP with Twilio
FuelPHP is a great framework, being developed by some of the CodeIgniter contributes. In this article I will be running through the process of adding a package and setting it up to send SMS’s via Twilio.
Prerequisites
- An instance of FuelPHP.
- A copy of Fuel-Twilio from GitHub. You can also type
php oil package install twilio
in shell.
Twilio
First you will need an account with Twilio. Goto https://www.twilio.com/try-twilio?home-page and register, as you will be sending SMS, you will probably want to add some credit too.
Once you have registered, goto https://www.twilio.com/user/account and make a note of your account sid and auth token, these will need to go into the package config file.
To send an SMS, Twilio requires you to need a valid ‘from’ number. This can either be a ‘Twilio number or a verified number.
- Twilio number – A number that Twilio provide, these cost $1 a month.
- Verified number – A number you own that has bee verified be Twilio.
Follow the instructions on Twilio to set one up.
So at this stage you should have an account sid, auth token and a verified from number.
FuelPHP
The first thing you need to do is copy fuel/packages/twilio/config/twilio.php to fuel/app/config/ and open it up in your editor.
Enter your account_sid, auth_token and from items.
Once this is done, sending an SMS is really easy:
<?php class Controller_Welcome extends Controller { public function action_index() { $twilio_response = $sms->create(array( 'To' => '+441234567890', 'From' => Config::get('twilio.from'), 'Body' => 'A sms message', ) ); $json = json_encode($twilio_response); $response = Response::forge($json); $response->set_header('Content-Type', 'application/json'); return $response; } } ?> |
Next I will be showing you how to generate TwiML to talk to your customers using FuelPHP!