monkeypaw201 Posted May 4, 2008 Share Posted May 4, 2008 i get the following error FTP server reports 550 Could not get file size when i run the following script <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_bluesky = "localhost"; $database_bluesky = "my_db"; $username_bluesky = "user"; $password_bluesky = "pass"; $bluesky = mysql_pconnect($hostname_bluesky, $username_bluesky, $password_bluesky) or trigger_error(mysql_error(),E_USER_ERROR); $n = 0; mysql_select_db($database_bluesky,$bluesky); $result = mysql_query("SELECT * FROM weather ORDER BY id ASC LIMIT 100"); while($row = mysql_fetch_assoc($result)) { /* THis is for the short metars*/ $file = file("ftp://tgftp.nws.noaa.gov/data/observations/metar/stations/".$row['icao'].".TXT"); if($file) mysql_query("UPDATE airports SET raw = '".$file[1]."' WHERE icao = '".$row['icao']."'", $bluesky); else mysql_query("UPDATE airports SET raw = '[Not Available]' WHERE icao = '".$row['icao']."'", $bluesky); /* THis is for the long metars*/ $file = file("ftp://tgftp.nws.noaa.gov/data/observations/metar/decoded/".$row['icao'].".TXT"); if($file) { $decrypt = NULL; foreach ($file as $v) { $decrypt .= $v."**"; } mysql_query("UPDATE airports SET decoded = '".$decrypt."' WHERE icao = '".$row['icao']."'", $bluesky); } else { mysql_query("UPDATE airports SET decoded = '[Not Available]' WHERE icao = '".$row['icao']."'", $bluesky); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/104027-solved-error-ftp-server-reports-550-could-not-get-file-size/ Share on other sites More sharing options...
hitman6003 Posted May 4, 2008 Share Posted May 4, 2008 Is it only one of the files in the directory on the ftp server, or all of them? Also, which directory? (decoded or stations?) Quote Link to comment https://forums.phpfreaks.com/topic/104027-solved-error-ftp-server-reports-550-could-not-get-file-size/#findComment-532538 Share on other sites More sharing options...
monkeypaw201 Posted May 4, 2008 Author Share Posted May 4, 2008 all of them, and both directories are getting the errors Quote Link to comment https://forums.phpfreaks.com/topic/104027-solved-error-ftp-server-reports-550-could-not-get-file-size/#findComment-532540 Share on other sites More sharing options...
hitman6003 Posted May 4, 2008 Share Posted May 4, 2008 I honestly don't know...it works fine from my fedora laptop using php5.2.5 CLI...which is weird since you are getting a server error. I used the following code: <?php print_r( file('ftp://tgftp.nws.noaa.gov/data/observations/metar/decoded/BGQQ.TXT') ); ?> Try a basic example (above) and see if it works. Quote Link to comment https://forums.phpfreaks.com/topic/104027-solved-error-ftp-server-reports-550-could-not-get-file-size/#findComment-532542 Share on other sites More sharing options...
monkeypaw201 Posted May 4, 2008 Author Share Posted May 4, 2008 That outputs Array ( [0] => Station name not available [1] => May 03, 2008 - 09:50 PM EDT / 2008.05.04 0150 UTC [2] => Wind: from the ESE (120 degrees) at 2 MPH (2 KT):0 [3] => Temperature: 14 F (-10 C) [4] => Dew Point: 12 F (-11 C) [5] => Relative Humidity: 92% [6] => Pressure (altimeter): 30.21 in. Hg (1023 hPa) [7] => ob: BGQQ 040150Z AUTO 12002KT 9999NDV ///004/// M10/M11 Q1023 RMK /// [8] => cycle: 2 ) Quote Link to comment https://forums.phpfreaks.com/topic/104027-solved-error-ftp-server-reports-550-could-not-get-file-size/#findComment-532545 Share on other sites More sharing options...
hitman6003 Posted May 4, 2008 Share Posted May 4, 2008 So, it's something else in your code that is causing the error...your server is capable of connecting to the noaa ftp server and retrieving the file. Perhaps you are trying to get a file that doesn't exist...for example, if your variable "$row['icao']" is empty, it would generate a string like: ftp://tgftp.nws.noaa.gov/data/observations/metar/decoded/.TXT to retrieve, which doesn't exist. Quote Link to comment https://forums.phpfreaks.com/topic/104027-solved-error-ftp-server-reports-550-could-not-get-file-size/#findComment-532547 Share on other sites More sharing options...
monkeypaw201 Posted May 4, 2008 Author Share Posted May 4, 2008 so.. now it works.. i didn't change anything... weird... i know anyway thanks hitman6003 Quote Link to comment https://forums.phpfreaks.com/topic/104027-solved-error-ftp-server-reports-550-could-not-get-file-size/#findComment-532552 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.