how to code teh post in php

I need the php code for the post request below:'/getSession', function (req, res) {

        // We need a URL from the client to call
        if (!req.body.url) return res.sendStatus(400);

        const options = {
                url: req.body.url,
                cert: Cert,
                key: Cert,
                method: 'post',
                body: {
                        merchantIdentifier: MERCH_ID,
                        domainName: DOMAIN,
                        displayName: 'estore',
                json: true,

        // Send the request to the server and return the response to the client
        request(options, function(err, response, body) {
                if (err) {
                        console.log('Error generating session!');
                        console.log(err, response, body);

Open in new window

Who is Participating?
leakim971Connect With a Mentor PluritechnicianCommented:
$merchantIdentifier = $_POST["merchantIdentifier"];
$domainName = $_POST["domainName"];
$displayName = $_POST["displayName"];

Open in new window

Chris StanyonConnect With a Mentor Commented:
Not clear what you actually need. If you want to read the post response in PHP, then you examine the $_POST variable


Open in new window

Newton21205Author Commented:
I have pasted the js code need php code for the same.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.