Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public class HttpCalloutSample {
  2.  
  3. // Pass in the endpoint to be used using the string url
  4.   public String getContent(String url) {
  5.  
  6. // Instantiate a new http object
  7.     Http h = new Http();
  8.  
  9. // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
  10.     HttpRequest req = new HttpRequest();
  11.     req.setEndpoint(url);
  12.     req.setMethod('GET');
  13.  
  14. // Send the request, and return a response
  15.     HttpResponse res = h.send(req);
  16.     return res.getBody();
  17.   }
  18.  
  19.   public String testContent()
  20.   {
  21.       return 'Testing ... 1... 2... 3...';
  22.   }
  23. }