2
$\begingroup$

Good morning,

I would like to know if anyone knows if it is possible to read files from servers with TLS using Mathematica. In particular, my interest is to read files from the CDDDIS server (NASA's Archive of Space Geodesy Data), it does not matter if with https or with FTPES (explicit FTP-SSL). For example:

Import["https://cddis.nasa.gov/archive/products/iers/predcoef.out", ????] Import["ftpes://gdc.cddis.eosdis.nasa.gov/pub/products/iers/predcoef.out", ???]

Or with other similar statement: URLDownload, URLRead, ...

Some reference help can be found at https://cddis.nasa.gov/Data_and_Derived_Products/CDDIS_Archive_Access.html, but my interest is to be able to access those files (https://cddis.nasa.gov/archive/products/iers/) from within Mathematica in direct reading, as if they were local files, having access to Earth Data.

Best regards.

$\endgroup$
2
  • $\begingroup$ As an additional comment, say that I have a username / password for this site, and that there are no difficulties in accessing those files with an ftp client outside of mathematica (with a FTP TLS explicit connection) or from a browser, or as mentioned in cddis.nasa.gov/Data_and_Derived_Products/…. The aim is to be able to access that information live from Mathematica. $\endgroup$
    – pgonibe
    Jun 16 at 11:10
  • $\begingroup$ Looks like a duplicate. $\endgroup$ Jun 17 at 17:42
2
$\begingroup$

In case it ever helps anyone, comment that I have gotten it to work using the java code as a reference:

MyImportListCDDIS[url_String, username_String, password_String]:=
   Module[{authorization, response, location, i, statusCode, answer},
     authorization = "Basic " <> ExportString[username <> ":" <> password, "Base64"];
     location = url;
     answer=Indeterminate;
     Do[response = URLRead@HTTPRequest[location, <|"Scheme"->"https", "Method"->"GET", "Headers"->{"Authorization"->authorization}|>, FollowRedirects->False];
        statusCode = response["StatusCode"];
        Switch[statusCode,
               200, answer=Import[response, "List"];Break[],
               302, location=Lookup[Association[response["Headers"]], "location"],
               _,   answer=$Failed; Print["Error-MyImportListCDDIS-HTTP"<>statusCode];Break[]
        ];
        , {i, 10}
     ];
     If[!ListQ[answer], Print["Error-MyImportListCDDIS-NotAnswer"]];
     answer
  ]

Greetings.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.