refactor to have a separate curl function to execute raw url