try to make a reusable function for httppost