Answer the question
In order to leave comments, you need to log in
Get json data in Bitrix from a mobile application?
Hello!
You need to receive orders from the mobile application and add them to the Bitrix website.
New orders come from the POST mobile application as json:
{
"version": "1.4.1",
"method": "neworder",
"platform": "android",
"appId": 112065,
"user": "user",
"data": {
"deliveryType": "Уточните у оператора",
"deliveryData": [],
"items": [
{
"count": 1,
"id": "577094"
}
],
"fake": 0,
"order_info": {
"name": "тест",
"phone": "999 999-99-99",
"email": "[email protected]",
"comments": null,
"pointId": null,
"regionId": "rest_267874043",
"payment_type": {
"id": "158ad92727wdew",
"title": "Наличные",
"type": "cash"
}
},
"payment": {
"type": "offline",
"transactionId": null
}
},
"region_data": {
"full_title": "Москва, город Москва, Россия",
"google_place_id": "ChIJybDUc_xKtUYRTM9XV8zWRD0",
"id": "rest_267874043",
"is_selected": true,
"title": "Москва"
},
"access_token": null
};
$postData = file_get_contents('php://input'); // ловим данные
$data = json_decode($postData, true);
$file = 'order.txt';
$current = file_get_contents($file);
$current = $postData;
file_put_contents($file, $current); // записываем в файл
Answer the question
In order to leave comments, you need to log in
Does this url open in the browser?
*for debugging such things there is a wonderful Restlet Client tool
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question