To see if the gates are open send in scouts. If they have scouts AND their gates are open they will try to defend. You’ll see in the battle report that you fought a fight to kill off their scouts. If this happens you know that their gates are open. If their gates are closed their scouts won’t try and stop you. This method obviously doesn’t work if they don’t have any scouts.
If they don’t have scouts you can send in 1 warrior. The battle report should tell you whether or not they used just defenses like archer towers and traps or whether or not warriors and archers came out to help fight.