<p>How do I query the iPhone's current IP address?</p>

You can try to use similar to this service:
Whatismyip
and capture the string :)
Credit to Erica Sadun's iPhone Developer's Cookbok, 2nd ed, page 555.