You don't state what platform you are running on. If you are running under windows, you will find that CGI is most likely setup to run as the "nt authority\system" user by default. When you are running as the "nt authority\system" user, you don't have network access which will preclude you from successfully running your script. Even if you are running under Linux / Unix you should still check which user your script is running as and what permissions they have.