Added php side of request and started error handling