Jump to content

[SOLVED] Error: FTP server reports 550 Could not get file size


monkeypaw201

Recommended Posts

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);
}
}
?>

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.

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 )

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.