How to read the contence of a file from the web


#1

Hello,

I need to read the contence of the file from this url:

http://www.celestrak.com/NORAD/elements/stations.txt

When I read the first 3 lines I get something like this

ISS (ZARYA)
1 25544U 98067A 17184.57774503 .00001416 00000-0 28671-4 0 9999
2 25544 51.6436 316.6286 0004942 353.9556 94.4022 15.54112690 64302

Have work trough the examples but could find a solution.

Please can you help me out with this?

With kindly regards.


#2

Good job. You did read read the file. Now you have to parse the data.

Here is their documentation on the contents of the file:
http://www.celestrak.com/NORAD/documentation/tle-fmt.asp


#3

Thanks for the reply.
The problem is to read the data with nsbasic from the web. That part has to to be fixed!!!
To parse the data is no problem, that part I have fix.

Still open the question " how can I read the data ftom the http as I mentiod before.

Again thank for any help


#4

When you say

When I read the first 3 lines…

How are you reading them?


#5

My original program is written in Python. This is a simple aproache. I have also done this in thechbasic. Open a stream and read the file with line input.


#6

I assume your site is not celestrak - so you will be reading from another site. The Ajax function is what you need. Start by reading this:

http://wiki.nsbasic.com/Ajax_made_Simple#Getting_Data_from_Another_Site

This solution requires a PHP script. There may be a better way - ask them if they have a web API you can use.

Otherwise, I found this:


#7

Thanks for the response.
But still I will stay by my question "Is it possible to read the file line by line from the URL"
Is that posible?

I have several apps on my IPAD who read from these files!!

This is a sample as I use in TechBasic, running on my IPAD
It’s opens a stream (1) from the web, and read line by line.

Comm.readHTTP(1, “http://www.celestrak.com/NORAD/elements/stations.txt”)
WHILE NOT EOF(1)
LINE INPUT #1, a$
PRINT a$
WEND
PRINT "Status code: "; Comm.statusHTTP(1)
CLOSE #1
FUNCTION statusHTTP (channel AS INTEGER) AS INTEGER

This simple connection I need. If this is not possible please let me know.
When you pass the url to your web browser the file is opened, and displayed.


#8

You read the entire file in, then use the split() function to turn it into an array of lines.

It’s much faster than making separate calls fro each line!


#9

Thanks George,

But how to implement this in NSB?

This is my problem.

Jan


#10

Did you read the Ajax article?

The file is on another system, so you need to use that to read the file.


#11

I have read them all!
Please can you specify this article.

And thanks for all effort


#12

The message which starts “I assume you site is not…”


#13

Pleae can you tell me wich document, can’t find


#14

I assume your site is not celestrak - so you will be reading from another site. The Ajax function is what you need. Start by reading this:

http://wiki.nsbasic.com/Ajax_made_Simple#Getting_Data_from_Another_Site

This solution requires a PHP script. There may be a better way - ask them if they have a web API you can use.

Otherwise, I found this:


#15

I have read all posible items about Ajax to understand how it works, and how it can be used
for reading the data from the web.
But I have total no experiance wit web programming! So for me it is hocus pocus.
To get succesfull started my privet tool I need the access to this file.
Please, please can someone provide me with a solution to it get started.

Again thanks for any help