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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 )
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.