PHP class for using the Emailvision CampaignCommander Notification Messaging API Service

So I wrote another PHP class you guys can use, this time for the Emailvision CampaignCommander Notification Messaging API Service, since I noticed there was none around. Usage is very simple, here’s an example.

Download from Github.

php-pushover, a PHP class for sending push notifications to iOS & Android

So I’ve been using Notifo for a while now and I must say, lovely service. Unfortunately, they will be closing down..

In my quest for a new push notification provider, I stumbled upon Pushover.
Pushover is by far the only service that can deliver (free) push notifications to both iOS and Android platforms, with a simple API, and a lot of cool options. Even authentication is very easy (not like Prowl). Have a look at their api docs.

Here’s the php class I wrote for Pushover:

And here’s how you use it:

$push = new Pushover();
$push->setToken('app token goes here');
$push->setUser('user token goes here');
$push->setTitle('Hey Chris');
$push->setMessage('Hello world! ' .time());
$push->setUrlTitle('cool php blog');
$go = $push->send();

Good luck! And let me know which cool projects you used this for! 🙂

Opencart send fax on order

In some cases, it’s useful to fax your orders to the store as soon as an order is placed. Now many people will think this is very hard, but in fact, it’s very easy to accomplish this. Thank god for API’s!

Browse your Opencart folder and go to /catalog/model/checkout/order.php, line 370 (after the following code), and add your fax code. If you put the code here, you can reuse the default HTML mail Opencart will send to your client (which includes all the order info).

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) {
	$html = $template->fetch($this->config->get('config_template') . '/template/mail/order.tpl');
} else {
	$html = $template->fetch('default/template/mail/order.tpl');

I’d like to use Interfax since they provide a very easy PHP API. Only 1 requirement, you’ll need SOAP. Now add this code:

	/**************** Settings begin **************/
	$username = ''; // Enter your Interfax username here
	$password = ''; // Enter your Interfax password here
	$faxnumber = ''; // Enter your designated fax number here in the format +[country code][area code][fax number], for example: +12125554874
	$texttofax = $html; // Enter your fax contents here
	$filetype = 'HTML'; // If $texttofax is regular text, enter TXT here. If $texttofax is HTML enter HTML here
	/**************** Settings end ****************/
	$client = new SoapClient("");
	$params->Username  = $username;
	$params->Password  = $password;
	$params->FaxNumber = $faxnumber;
	$params->Data      = $texttofax;
	$params->FileType  = $filetype;
	$faxResult = $client->SendCharFax($params);

Et voila. The email sent to your client for notification will also automaticly be faxed to the given fax number.

Automatically create .m3u playlists with bash (for QNAP iTunes Server)

One of the cool features of my new QNAP 412 Turbo Nas is iTunes Server. This basicly allows you to create playlists, and share them among your home network. I haven’t figured out yet if it’s also possible to sync these to your iOS devices, but we can atleast (easily) share our music library to all our devices.

Qnap comes with so called ‘smart playlist’, but I don’t like those. I prefer my playlists per CD or folder. In order for this to work we’ll have to create an m3u playlist for EACH folder you want to share, this can be a daunting task.. Here’s a way to automate this. This script uses recursion to find all audio files in the parent folder + child folders. Since iTunes uses the m3u’s filename as playlist title, this script will use the folder name for this.

SSH to your server (QNAP default user = admin), and cd yourself to your music folder. Now create a bash script and give it execute permission:

cd /Qmultimedia/Music/
chmod +x

Now enter the following code. I found this neat script here, and stripped it down to the necessary commands, and implemented the removal of old m3u’s (in case you delete/update Music folders).



/opt/bin/find . -type f -name "*.m3u" -exec rm -f {} \; # remove all existing m3u's

rm -f $M3Ulist

indexCurrDir ()
FileList="" # initialize empty variable FileList
for FileTypes in "ogg" "mp3" "flac" "wav" # loop over file types.
FindFiles=$(/opt/bin/find $(pwd) -type f -iname "*.$FileTypes" | sort)

if [ "${#FileList}" != "0" ] # do not write m3u file if file list is empty
echo "$CurrDir"
m3uName=$(basename $CurrDir)

echo "Writing m3u playlist."
echo "$FileList" > "${m3uName}.m3u"
echo "$CurrDir/${m3uName}.m3u" >> "$M3Ulist"

AllDirs=$(/opt/bin/find $(pwd) -type d | sort)

for Directory in $AllDirs
cd "$Directory"

exit 0

Now you can easily create m3u’s for your complete music folder by running:


You can also put this in a cronjob for automating things. Here’s more info on cronjobs on a QNAP.