Man rescued from cliff after trying to help dog