writing SendRequest function