Created
April 12, 2019 12:42
-
-
Save SalesforceBobLightning/d215e5779ad4212783e1dea1e7716e4e to your computer and use it in GitHub Desktop.
What is my Salesforce IP Address using Apex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class NetworkUtils { | |
public static String WhatIsMyIPAddress() { | |
HttpRequest request = new HttpRequest(); | |
// Don't forget to add http://icanhazip.com as a remote site. | |
request.setEndpoint('http://icanhazip.com/'); | |
request.setMethod('GET'); | |
HttpResponse response = new Http().send(request); | |
return response.getBody(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment