All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Only Allaah The Almighty knows the Ghayb (unseen). Believing that any human can foretell the future is a type of apostasy according to Sharee‘ah texts. Allaah The Almighty Says (what means):
• {Say, "None in the heavens and earth knows the unseen except Allaah.} [Quran 27:65]
• {Say, [O Muhammad], "I do not tell you that I have the depositories [containing the provision] of Allaah or that I know the unseen."} [Quran 6:50]
• {Say, "I hold not for myself [the power of] benefit or harm, except what Allaah has willed. And if I knew the unseen, I could have acquired much wealth."} [Quran 7:188]
‘Aa’ishah said that a person who alleges that the Messenger of Allaah, sallallaahu ‘alayhi wa sallam, could foretell what would happen in the future would be telling a tremendous lie against Allaah The Almighty. She then mentioned the verse which means: {Say, "None in the heavens and earth knows the unseen except Allaah."} [Quran 27:65] [Muslim]
The Devil has several ways to influence people. You should ask Allaah The Almighty to protect you against the intrigues of the Devil. Most of the soothsaying of astrologers is based on lies and conjecture. For example, an astrologer may tell you that you will marry a woman from your circle of society and that you will have some children. What this liar tells you is common. Many people marry and have children. Moreover, an astrologer may predict a war between two countries in a decade’s time due to the strained relations between them. Afterwards a war erupts because Allaah The Almighty has decreed that this war will erupt. However some people are awed thinking that a prophecy has come true. Indeed, many observers can predict what may happen in the future based on current affairs. Furthermore, an astrologer may tell you about one of your personal affairs. This too can be explained. Allaah The Almighty Says (what means): {And thus We have made for every prophet an enemy— devils from mankind and jinn, inspiring to one another decorative speech in delusion. But if your Lord (Allaah) had willed, they would not have done it, so leave them and that which they invent. And [it is] so the hearts of those who disbelieve in the Hereafter will incline toward it and that they will be satisfied with it and that they will commit that which they are committing.} [Quran 6:112-113]
Commenting on this verse, As-Suddi said that every human has a devil and every Jinn has a devil. The devils accompanying humans and Jinns exchange information about their respective companions. The devil accompanying a person knows more information about him than his relatives do. These devils accompany humans all the time. It is possible that when a person goes to see a soothsayer, the devil accompanying him meets the devil accompanying the soothsayer and gives him information. Afterwards, the devil accompanying the soothsayer conveys the information to his companion. This is a test from Allaah to see whether His slaves believe in the verse (which means): {(He is) Knower of the unseen, and He does not disclose His [knowledge of the] unseen to anyone.} [Quran 72:26]
To prove the falsehood of those who claim to foresee the future, you can ask them about what will happen tomorrow, or just pick some pebbles at random and ask them how many there are.
A foreteller may be able to say something true. This happens when his devil companion spies on heaven and tells him about what he has heard, as indicated by the Prophet, sallallaahu ‘alayhi wa sallam.
Also, that astrologer you mention might have based his predictions on the prophecies mentioned in the scriptures of the Jews and Christians. The scriptures of the Jews and Christians, although distorted, contain some true prophecies. Indeed, Muslims are forbidden from seeking guidance from these scriptures.
You said that Allaah The Almighty makes some people know certain matters of the Ghayb (the unseen). This is true. This applies to the nation of the Prophet, sallallaahu ‘alayhi wa sallam, and to previous nations. Please read Fatwa 5416 on this subject.
Allaah Knows best.