How much is listening to your customers worth?

I normally don’t write about work. The reason is that I feel that the slight chance that someone might feel I’m being biased towards a product that comes from the company I work for and dismiss my thoughts as “guerilla marketing” is not worth it.

However, I’m going to make an exception - and that’s because I prefer selling Zend here rather than doing it on Lukas Smith’s blog :)

Lukas raises the question of what commercial PHP distribution should be used as an alternative to RHEL outdated packages. My answer on that would be, surprisingly - use Zend Server! (well, …once it’s out of beta, of course).

Lets put the features and SLA you get from Zend Server aside for a moment.

The real reason I think you should use Zend Server is because the Zend Server product manager (hey, that’s me!) reads your blog. I’m serious about this.

I’m not sure I can quantify this, but I think that a vendor that listens so closely to what potential users (and the community) has to say is worth quite a lot in the long run. And yes, Zend has not been perfect in listening to the community - but I can honestly and whole-heartedly say that we are trying harder. The recent feedback on Zend Server gives me the feeling that we are doing ok too.

NetworkManager: Auto-HTTP login to a Wifi network

One of the cafés in my area where I frequently drink / work requires you to pass through an annoying web page forcing you to agree to some terms before allowing you to access the Internet through their Wifi network. It's free - but they still annoy you with this silly HTTP gateway. This is actually a frequent thing in Israel - most cafés offer free Wifi access, but some will require to to log-in nevertheless.

So today I figured out how to get NetworkManager to automatically work around this HTTP gateway for me whenever I connect to Arcaffe's Wifi network. Since it's super cool, and since I bet lots of people are annoyed by these sort of Wifi gateways, here's how to do it:

Apparently, NetworkManager allows you to create special post-connect or post-disconnect scripts that are executed when a network interface is brought up or down. Here is what I did:

I Created the following script and saved it at /etc/NetworkManager/dispatcher.d/100httpgateway.sh:

CODE:
  1. #!/bin/sh
  2.  
  3. IFACE="eth1"
  4.  
  5. if [ "x$1" = "x$IFACE" ] && [ "$2" = "up" ]; then
  6.     # Figure out the wifi SSID
  7.     SSID=$(/sbin/iwconfig $IFACE  | grep ESSID | cut -d: -f2 | sed 's/^\s*"\(.*\)"\s*$/\1/')
  8.  
  9.     case "$SSID" in
  10.         "012-ArCaffe")
  11.            URL='http://captive.012.net.il/user/refresh/home?confirmed=true&submitButton=+OK+&CPURL=http%3A%2F%2Fwww.arcaffe.co.il%2F&t=fsm3j5oe'
  12.            DATA='x=9&y=5&agree=on&username=arcaffe&password=arcaffe012'
  13.            COOKIE='Cookie: JSESSIONID=uc54121j305s; cookies=true'
  14.            REFERER='Referer: http://captive.012.net.il/home?confirmed=true&submitButton=+OK+&CPURL=http%3A%2F%2Fwww.arcaffe.co.il%2F&t=fsm3j5oe'
  15.  
  16.            curl -d "$DATA" -H "$COOKIE" -H "$REFERER" "$URL"> /tmp/arcaffe.last 2> /tmp/arcaffe.last.err
  17.         ;;
  18.     esac
  19. fi

Don't forget to make the file executable - I did it by running chmox +x /etc/NetworkManager/dispatcher.d/100httpgateway.sh.

Some things you should note:

  • "012-ArCaffe" is the ESSID of the network I'm logging in to. This of course work for ArCaffe in Israel, but you should change that with your network's ESSID.
  • Replace the value of IFACE with the name of your wireless interface
  • $1, the first parametter passed by NetworkManager to the script, is the network interface that was just connected or disconnected
  • $2, the second parameter, is "up" or "down" - the status of the interface.
  • The code I have inside the case block is where the magic happens. In this case, I send an HTTP POST with the correct parameters, Cookie and Referer headers and URL. This causes ArCaffe's gateway to log me in
  • I use curl - but I could have also used wget or any other tool to do the job
  • The -d flag sends the POST data, the -H flags set a header
  • I figured exactly what request to send using LiveHttpHeaders - but you can also use tcpflow or any other packet sniffing or HTTP sniffing tool
  • You can add more options to the 'case' statement for more networks that need that sort of treatment. With a little of bash-fu that should be no problem.

That's it! Man I love Linux today :D