Use ETH SMS service for sending texts abroad

The following simple website demonstratates how to send texts using the free SMS service of the ETH (you need to be member of). The core task of the website is to send a HTTP post request to the following website:
https://www.sms.ethz.ch/cgi-bin/sms/send.pl

The documentation is found here:
https://www.sms.ethz.ch/sms/simpledescription.htm

The header data consists out of your ETH username and password, the action you want to perform, the message you want to send and some further stuff. In the following code I use the libcurl library to send the request. If you have enough permissions on your server you can install it by typing:

Take a look at the code. You might ask, why I use a fixed destination number. Well the webinterface was just meant to send SMS to my phone! The service even transmits text to other countries. I don’t know whether it is working wordwide:

Warning:

If you put this script on a webserver, make sure the file is not readable for other people, because it contains sensitive data! (your password)