Can You Mimic Firefox Session in Other (PHP) Code?
Not sure if this is possible, so wanted to ask the experts.
I have a client who has to access a web-based mailbox that utilizes two-factor authentication. So they enter a username and password, and they then look at an app to get an access code. Once entered, and a few choices later, they have their mailbox. The mailbox has links to view each mail in a new window, and from there they can save the attachment they need. I have yet to see a plugin that will follow the new tab and download from w/in it.
I'm trying to see if, once they manually login, and if they could keep the session alive, could I then use server-side code to utilize the existing Firefox connection to then follow the links and automatically save the attachments for them? This would save them a lot of time.
Just curious if it's possible. Thanks for reading.
All Replies (2)
PHP has features to emulate a browser session by sending the same cookies and other headers, but a well-secured server might not be fooled.
Also, unless you plan to save the attachments on the server, you should just use code in the browser. If there is no pre-built extension to do it, consider whether you could create a userscript to do it. User scripts can be applied to pages in Firefox using one of these extensions: Tampermonkey, Violentmonkey, or Greasemonkey.
Greasemonkey is the best known, but because its API was modernized last Fall, a lot of older code no longer works in GM.
Thanks @jscher2000. I was wondering if, once I had the list of "new window" links in PHP (or whatever code we decided to use) that we could download somehow through FF itself, keeping the same session.
I will take a look at what you mentioned. Much appreciated!