Page 1 of 1

PHP script dies if php_network_getaddresses: gethostbyname f

Posted: Tue Dec 16, 2003 1:56 am
by yurr
I'm trying to connect to FTP server using PHP script (enclosed in if-else). In the network is in bad condition or absent, script throws out an error and the rest of the code is not performed.

Code: Select all

Warning: php_network_getaddresses: gethostbyname failed in c:\www\soft\get.php on line 80

Fatal error: Maximum execution time of 30 seconds exceeded in c:\www\soft\get.php on line 80
If the network is present but the script cannot find host (e.g. unexisting host) - everything goes fine.

The code fragment:

Code: Select all

if ($FTPcon3 = ftp_connect($server3, 21, 90)) {
   if (ftp_login($FTPcon3, $user3, $pass3)) {
      if (ftp_chdir($FTPcon3, $remoteDir3)) {
          if (ftp_fget ($FTPcon3, $fp3, "file.txt", FTP_ASCII)) {
		//some code here          

	  }
      }
   }
}		
print "test";
Any ideas?