add function to handle setting the http response code if php < 5.4, update method of getting the requested url