cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Uncharted

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