trim URL in curl function