Is the server run by you....what kind of server is it? just a webserver answering the requests...
I see that your php uses HTTP-Requests, but how are they handled on the other side.....
Maybe I am way of now...if so, I just have to educate myself a litte more before presenting a solution