i am building a app which takes input from user and then search to a remote database(MySql).And then display the retrieved data on VisualForce page.One important note that my app will be distributable.
here is my controller class
public with sharing class Search
{
public String strTag {get;set;}
public String strlocation {get;set;}
public PageReference find() {
return null;
}
}
Thanks in advance.
Updated
public with sharing class Search
{
public String strTag {get;set;}
public String strlocation {get;set;}
public PageReference find() {
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('https://localhost/salesforce/');
req.setMethod('POST');
req.setCompressed(false);
req.setBody('key1=value1&key2=value2');
req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
try {
res = http.send(req);
} catch(System.CalloutException e) {
system.debug('Callout error: '+ e);
}
system.debug(res.getBody());
return null;
}
}
I am getting below error now
error message System.CalloutException: Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = localhost/salesforce
strTag
andstrlocation
then I can provide ans yesterday only . Ok no issue which object record you want to query ?