I created Microservice and I wanted to send some object data to php server
{
_id: '5ef3018e8fbebe7395a586d2',
name: 'Jimmy',
user: 'Alexa',
email: 'jimmalexa@yopmail.com',
logintype: 'NORMAL',
}
when I send this above data probably it says wrong input inside postman and when I convert this to string
{
"_id": "5ef3018e8fbebe7395a586d2",
"name": "Jimmy",
"user": "Alexa",
"email": "jimmalexa@yopmail.com",
"logintype": "NORMAL",
}
It worked how do transform my data and send to php that can understandable
getting input in php I am doing like this :
$Users->insertTo(json_decode(file_get_contents('php://input'), true));
var data = {
_id: '5ef3018e8fbebe7395a586d2',
name: 'Jimmy',
user: 'Alexa',
email: 'jimmalexa@yopmail.com',
logintype: 'NORMAL',
}
var options = {
url: xyz.com/insert,
form: { input: data }
};
request.post(options, function(err,result,body){
var res_data = JSON.parse(body); cb(true)
})