Can cranberry pills cure a urinary infection?

No. Cranberry pills can help symptoms of UTI but will not cure uti.
No. There is some data to suggest that this may help to prevent recurrence, but the amounts of cranberry necessary for this are far more than you are likely to tolerate. You cannot cure UTI with cranberries.