BookmarkSubscribeRSS Feed
Ryanb2
Quartz | Level 8

I'm trying to find a way to use SAS to automatically login to a front-end web portal to then enter filter criteria (e.g., date range) and select download.  I would also have to deal with an "Are you sure you want to download this file..." popup window.  Can you direct me to an article or post that addresses how this can be done in SAS?  My hope is that I can automate this process so it can be run overnight.

 

I tried googling this topic but it was difficult to narrow down the search parameters to get what I needed.  Any information you can provide is appreciated.

 

Thanks,

Ryan

5 REPLIES 5
ChrisHemedinger
Community Manager

Hi @Ryanb2,

 

Any chance that the web portal you're using also offers an API?  If so, it would be much easier to use PROC HTTP and REST methods to drive this.

 

If not, then I think PROC HTTP is still your best hope.  If the site uses Basic Auth then the signin could be simple with options on the proc.  If not, then a more complex authentication might require that you add an auth key into the HEADERS statement.

 

The confirmation dialog is a special problem though.  Maybe there is a URL parameter supported by the site that would bypass this?  You might need to spy on the http traffic using your browser's debugging features to see what's going on.  

 

Aside from looking for an API method, I'd start by looking to see of another person has automated this using a tool like cURL.  If so, it's pretty straightforward to translate those commands to PROC HTTP.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Ryanb2
Quartz | Level 8

Thanks for the response Chris.  Unfortunately this web portal doesn't offer an API. 

 

I checked out the link in your reply but I'm not familiar enough with web syntax or language to know even what post and get mean.  I also googled proc http but didn't find anything that was more user-friendly.  I was hoping to find an example that showed a web page and the code used to login.

ChrisHemedinger
Community Manager

Is this a web portal that is open to the internet -- something we can look at?  Or is it internal to your organization?

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Ryanb2
Quartz | Level 8

I appreciate your willingness to look at the website.  It is a web portal open to the Internet, but due to the sensitive nature of the data and the restrictions required to access them I don't feel comfortable posting the link here.

Ryanb2
Quartz | Level 8

I don't know if this is helpful but I pasted the html associated with the user name and password below:

 

        <form method="POST" action="login" id="login" name="login">

          <div class="row-fluid nowrap">

            <div>

              <label>User Name:</label>

              <input type="text" autocomplete="off" placeholder="" name="username" autofocus="true" >

            </div>

            <div>

              <label>Password:</label>

              <input type="password" autocomplete="off" placeholder="" name="password" size="14" maxlength="12">

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1685 views
  • 0 likes
  • 2 in conversation