Skip to content

Instantly share code, notes, and snippets.

@SalesforceBobLightning
Created April 12, 2019 12:42
Show Gist options
  • Save SalesforceBobLightning/d215e5779ad4212783e1dea1e7716e4e to your computer and use it in GitHub Desktop.
Save SalesforceBobLightning/d215e5779ad4212783e1dea1e7716e4e to your computer and use it in GitHub Desktop.
What is my Salesforce IP Address using Apex
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