I'm agoraphobic and it definitely sounds like you're having panic attacks. I would recommend going to the doctor, because they'll be more knowledgeable and will be able to refer you to someone if necessary.
Don't worry too much though. Most people have a period in which they get panic attacks, it's just it doesn't develop for everyone. You've got to think, "Right, I've been nervous, but that doesn't mean it's going to happen again. It didn't happen before, so why will it happen again? It won't". I know how tough that is!
If you're having a panic attack there are a number of things you can try to calm yourself down. Take deeep breaths. Pick a three-digit-number and count back in 7s, so you're concentrating on something else. If you're having negative thoughts, try and reverse them (e.g. if you were thinking "My friend didn't wave when I saw her, she can't like me" think "She didn't see me" - obviously that's not the kind of negative thinking you have during a panic attack, but it's an example!) Oh, and you can clench your muscles really hard and then relax them. Do it for every muscle in your body from your toes to your head (or vice versa). Do this at night too, before you go to sleep (which you should get lots of!) There are a number of techniques (I can't remember any others though).
If you do need to go out, don't get embarrassed. It's not your fault, and it's not something you can help, although you can learn to control it (and it might not even happen again!).
Hope that helps and good luck x