Complete code to use curl