Quran says
This are the tidings of Unseen that We reveal to you in secret”.Surah-Ale-Imran, verse 44.“Nor will He disclose to you the secrets of the Unseen. But He chooses of His Apostles (For the purpose)”Surah-Ale-Imran, verse 179.“The Knower of Unseen reveals not His secret to anyone. Except to His chosen Messengers”.

Surah-Al-Jinn, verse 26.“…Allah has sent down to you the Book and Wisdom and has taught to you what you did not know, and great is the grace of Allah upon you.” Surah Al-Nisa, Verse 113.Imam Tabari writes under this verse:Allah TA’ALA has told the Prophet (May Allah bless him and grant him peace), you must thank Allah TA’ALA Who has informed you of what has already happened and what will happen in the future and this is a great grace of Allah upon you. (Tafsir Tabari under verse 113 of Surah Al-Nisa). The above Qur’anic verses prove that Allah TA’ALA has given Muhammad (May Allah bless him and grant him peace) the knowledge of the Ghayb.