cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Craige_Hales
Super User
Web site wants a password

Question from @billkopp.

Using cURL to supply basic authentication credentials.  Replace "user" and "pass"  appropriately.  Remove the -k if you don't need it; it bypasses the checking for a valid signing authority on an https site's certificate (you probably know if you are using a self-signed certificate...then you'll need it).  DO use https if available; it will keep others from seeing the password...unless your script is left on your screen...

The example assumes Windows users put a copy of curl.exe on the desktop.  Mac users are good to go.

The last two lines open the downloaded CSV in JMP and do some basic error reporting.

 

 

if( HostIs("Windows"),
  data = RunProgram(
  executable( Convert File Path( "$desktop", windows ) || "curl.exe" ),
  options( "-k -s -u user:pass --basic https://example.com/demo/demo.csv" ),
  readfunction( "blob" )
  );
, // else mac version
  data = RunProgram(
  executable( "/usr/bin/curl" ),
  options( {"-k", "-s", "-u", "user:pass", "--basic", "https://example.com/demo/demo.csv"} ),
  readfunction( "blob" )
  );
);
 
try( dt = open(data, "text"); error="", error=exception_msg; dt=empty() );
show(dt,error);

 

 

Last Modified: Nov 16, 2016 3:13 PM