I am planning to buy an iPhone 6 from an online store. But I have been told that if I buy from anywhere except the Apple store, I won't be able to enjoy the benefits of the warranty and guarantee. Is that true?
You can research Apple's warranty at http://apple.com/legal
You will have consumer law protections if you can prove you purchased product in a certain place. Those trump any warranty.
Apple's warranty is attached to the phone (or any serialized product), so all that matters is what country that serial number was first sold as Apple's records show. They then warrant that one device under that one legal framework.
The warranty doesn't need proof of purchase, but most of the agreements I've read say "Apple or its agents may require that you furnish proof of purchase details" which protects them against stolen or counterfeit serial numbers if there is doubt.
I would recommend you get a written invoice with the business name and the serial number of the iPhone so you are covered in case Apple exercises the "may require" clause, but I've never heard of anyone actually reporting that they needed to provide proof of purchase as Apple typically honors their warranty to the letter and often treats consumers better than the warranty allows.
Apple will honor the warranty of any device sold from an authorized dealer. If you buy a second hand device from an individual I believe the original warranty is in effect from the original sale date. EG the warranty starts from the time Apple or the authorized dealer sold it to the person you bought it from.
Your best bet might be to ask someone at an Apple store for a definitive, authoritative answer. Either that or call Apple support.