Rearranged httpPost method and set user agent