Just altered the code above as I relaised I had cut off the end of one of the lines. We currently use facility along with a lot of web pages we made...
For the facility (not progresso) api we came up with the following using php on linux, this is just a test script we used to check we could access it...