curl in function