My iPhone with broken power button randomly switched off and is not switching on.

It was just lying in the table and randomly switched off.
The battery was around 40%.
So any method which will work?
P.S that the power button is broken.
Get the power button fixed. It's possible that it's causing a short of some sort.

Original thread: https://forums.imore.com/threads/my-iphone-with-broken-power-button-randomly-switched-off-and-is-not-switching-on.387342/