PHP script dies if php_network_getaddresses: gethostbyname f

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yurr
Forum Newbie
Posts: 1
Joined: Tue Dec 16, 2003 1:56 am
Location: Ukraine
Contact:

PHP script dies if php_network_getaddresses: gethostbyname f

Post 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?
Post Reply