use cURL instead of system call