function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MrTikMrTik 

Trying to read external web page

I'm trying to read an external web page into my VF page. This is the code that I am trying to run, however I get a login screen instead of the web page content.

 

public with sharing class MyController {
    public String valueOne { get; set; }
    public String valueTwo { get; set; }
    public String page {get; set;}
 
    public PageReference DownloadUrl(){
        System.debug('Reached Here');
        HttpRequest req = new HttpRequest();
        req.setEndpoint('http://www.google.com');
        req.setMethod('GET');
        Http http = new Http();
        HTTPResponse res = http.send(req);
        //page = res.getBody();        
        System.debug(res.getBody());
        return null;
    } 
}

 

Can someone take a look and please let me know if I am missing something?

 

Thanks.