Port check( explaintion what i mean in para) in Developer Help
You could pull the info from this website and return false or true depending....
A port will not report as open if you do not have something using it..
Apache webserver uses port 80 (standard for websites).
I have closed apache now my port reports as closed.
I have now re-opened apache and it is now reporting as open