You need to sign in to do that
Don't have an account?
How to read parameters on php page passed by salesforce callout
Hi everyone...
I am passing 2 parameters from Salesforce to a php page using following code...
public class WebServiceCallout {
@future (callout=true)
public static void sendNotification(String name, String email) {
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('http://panelhouserepairs.com.au/EmployeeProfiles.php');
req.setMethod('POST');
system.debug('yesss' +name);
system.debug('yesss' +email);
req.setBody('name='+EncodingUtil.urlEncode(name, 'UTF-8')+'&email='+EncodingUtil.urlEncode(email, 'UTF-8'));req.setCompressed(true);
// otherwise we hit a limit of 32000
try {
system.debug('yesss' +name);
system.debug('yesss' +email);
res = http.send(req);
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
System.debug(res.toString());
}
}
// run WebServiceCallout.testMe(); from Execute Anonymous to test
public static testMethod void testMe() {
WebServiceCallout.sendNotification('My Test Contactr','My Email');
}
}
Can i anyone let me know the code to read passed 2 parameters on the php page.....
Thanx in Advance
Hi
You should be able to refer to them as
$_POST['name']
$_POST['email']
like this for example