How to send a request after httpURLconnection redirection

give me a brief answer and describe my question.
my purpose is to visit website A, but if I do not log in to website A directly, I will be redirected to website B.
that is to say, I must go through the login operation of website B to access the target website. After I connect to website A with httpURLconnection, it is actually website B. if I submit login information, if I visit website An again?
httpURLconnection request is to submit data first, then accept the resources of the web page, and then I want to operate on the resources received. What should I do? I don"t want to be able to submit any more requests!

Mar.22,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1beab2c-31a2b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1beab2c-31a2b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?