For those who needs this later, you can set up http proxy and send a simple get request to https://api.ipify.org , it will give you the ip adress in plain text, no need to parse the json.
One of many simple and easy ways to do it.
Since you're having alot of problems, send me a PM with your current theory on why its crashing so I can help you dive into this issue and get it fixed for you if possible!