changed curlPost function