No, this won't have the desired effect. In order to transmit data in an encrypted way, you have to establish an encrypted connection first. The way above you transmit your data to the server before the encrypted connection is established i.e. without encryption!