or download this
system("ftp -n $gsRemoteMachine <<EOF> $gsStatusFile 2>&1\n\nuser $gsF
+tpId$gsGateConnect $gsFtpPwd\nverbose\n$gsFtpMode\nput $gsFeedsDir$gs
+FeedZipFile $gsRemoteDir$gsFeedZipFile\nclose\nbye\nEOF");
...
# send admin email
email_error($gsEmailAdmin, $gsErrSys, $gsErrSys."FTP failed.\nFTP se
+ssion:\n@gaStatusLines");
}