r/AskProgrammers • • 15d ago

Script to connect to a website

Hi all ✌️

I was wondering, is it doable to make a (shell?) Script that opens a website and connects me to it.

Like using curl to send the information once the page is open.

I was wondering because I would like to use more private navigation without having to enter my infos every time.

I did some research on the web and didn't find what I was looking for.

3 Upvotes

20 comments sorted by

View all comments

Show parent comment

1

u/RVTEL666 14d ago

Private browsing (also known as incognito mode or private mode). My bad, not English native 😅

2

u/Fadamaka 14d ago

Curl and your browser (incognito or not) cannot and will not share anything. You sending a post request via curl to the login url won't log you in the browser. Curl is a tool for interacting with the internet without a browser.

Basically when you login on a website your browser send over your username and password and gets something in return that it can use for further requests. What it gets back is more often than not is a cookie. You curl request will most likely get back a cookie as well but that cookie cannot be transfered to the browser.

If you really want to make a script to login on a website with incognito mode you could use something that can take control of your browser. For example you could use Puppeteer to open an incognito browser and login with your username and password and keep the browser open after. But becareful. You should not be writing down your passwords in text files.