Perhaps , you can use curl -i -i option will show response headers in output As a result , you can easily extract the ip you want from the output