While you might be able to get the URL of a website from an IP address, you can't be sure that you've got the right one.
Multiple websites can be hosted on a single IP address, so the best you can hope for is that a reverse DNS lookup will give you the name of a website - it might just give you a server name.
Example:
dig www.google.com
gives me a CNAME with 6 IP addresses:
www.google.com. 86399 IN CNAME www.l.google.com.
www.l.google.com. 299 IN A 209.85.146.105
www.l.google.com. 299 IN A 209.85.146.99
www.l.google.com. 299 IN A 209.85.146.104
www.l.google.com. 299 IN A 209.85.146.106
www.l.google.com. 299 IN A 209.85.146.147
www.l.google.com. 299 IN A 209.85.146.103
Reverse DNS lookup on the first of these addresses (
dig -x 209.85.146.105
) gives me a different name:
105.146.85.209.in-addr.arpa. 86400 IN PTR bru01s01-in-f105.1e100.net.
- which doesn't say anything useful about any websites.