Measurements of branching fractions in B→φK and B→φπ and search for direct CP violation in B±→φK±