Не получен идентификатор сделки, когда стадия сделки изменяется на диске Pipe с API push-уведомлений. Я получаю ответ
echo $result = file_get_contents('https://api.pipedrive.com /v1/pushNotifications?api_token=my-appid');
Это код, который я вставил при запуске сообщения http
{"success":true,"data":
[{"id":7,"user_id":750195,"company_id":538560,"subscription_url":"https:\/\/empathi-solutions.com\/pipe\/pip.php",
"type":"regular","event":"updated.deal","http_auth_user":"","http_auth_password":"",
"add_time":"2015-08-03 07:41:04","active_flag":true,"remove_time":null,"http_last_response_code":200},
{"id":8,"user_id":750195,"company_id":538560,"subscription_url":"https:\/\/empathi-solutions.com\/pipe\/pip.php",
"type":"regular","event":"*.deal","http_auth_user":"","http_auth_password":"","add_time":"2015-08-03 08:47:56",
"active_flag":true,"remove_time":null,"http_last_response_code":200}],"additional_data":{"pagination":
{"start":0,"limit":100,"more_items_in_collection":false}}
}
Пожалуйста, дайте мне знать, Как я могу получить сделку, какая стадия была изменена?
Ты можешь использовать json_decode
функция.
Попробуй пример
$result = file_get_contents('https://api.pipedrive.com/v1/pushNotifications?api_token=my-appid');
$result = json_decode($result, true);
foreach($result['data'] as $deal)
{
echo "ID: ".$deal['id']."<br />";
echo "User ID: ".$deal['user_id']."<br />";
echo "Company ID: ".$deal['company_id']."<hr />";
}
ОБНОВИТЬ
$result = <<<JSON
{"success":true,"data":
[{"id":7,"user_id":750195,"company_id":538560,"subscription_url":"https:\/\/empathi-solutions.com\/pipe\/pip.php",
"type":"regular","event":"updated.deal","http_auth_user":"","http_auth_password":"",
"add_time":"2015-08-03 07:41:04","active_flag":true,"remove_time":null,"http_last_response_code":200},
{"id":8,"user_id":750195,"company_id":538560,"subscription_url":"https:\/\/empathi-solutions.com\/pipe\/pip.php",
"type":"regular","event":"*.deal","http_auth_user":"","http_auth_password":"","add_time":"2015-08-03 08:47:56",
"active_flag":true,"remove_time":null,"http_last_response_code":200}],"additional_data":{"pagination":
{"start":0,"limit":100,"more_items_in_collection":false}}
}
JSON;
$result = json_decode($result, true);
foreach($result['data'] as $deal)
{
echo "ID: ".$deal['id']."<br />";
echo "User ID: ".$deal['user_id']."<br />";
echo "Company ID: ".$deal['company_id']."<hr />";
}
Других решений пока нет …