Yes, you can. Almost everywhere you can write domain name - you can write ip.
But there are nuances
1. In the comments, you write that you are trying to send a request to the ip, which was the location of the requested resource 4 years ago - most likely it is no longer there.
2. in HTTP there is a Host header and the server can simply drop those requests that are addressed to the ip, instead of the domain (this is needed in cases where one ip contains several sites)