We can access the php code in salesforce using @future(callout=true/false). The function we make for accessing the php code in apex class is of static type and does not return any value.
Syntax:
@future(callout=true)
public static void function_Name()
{
//variable declaration
try
{
Http h = new Http();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
req.setTimeout(60000);
String url =”//Path for the php code”;
req.setEndPoint(url);
req.setMethod('GET');
res = h.send(req);
String response = res.getBody();
}
catch(exception e)
{
system.debug('Save file to server exception :'+e);
}
}
