I heard there was a way to give your ranger Magic, not by weapons and armor. Is that true? If so how do I gain it? What level and what types of magic can a ranger get? The book I've been reading for this information is the Players Handbook
Reach 2nd level.
The Ranger gains the Spellcasting feature at 2nd level (Player's Handbook, pg. 91):
By the time you reach 2nd level, you have learned to use the magical essence of nature to cast spells, much as a druid does.
The ranger is what is commonly called a "half-caster", the highest level spells they can ever cast is 5th, which they can do starting at 17th level. The ranger learns spells from the Ranger spell list (PHB, pg. 209).