Better url encoding of curl params plus a fix so that grep only returns the first csrf token