Запрос GET выглядит так:
{
"_links": {
"self": {
"href": "/api/v2/leads?status=20728261",
"method": "get"
}
},
"_embedded": {
"items": [
{
"id": 1601345,
"name": "Тест",
"responsible_user_id": 2600929,
"created_by": 2600929,
"created_at": 1531976544,
"updated_at": 1531985130,
"account_id": 20728252,
"is_deleted": false,
"main_contact": {
"id": 4573131,
"_links": {
"self": {
"href": "/api/v2/contacts?id=4573131",
"method": "get"
}
}
},
"group_id": 0,
"company": {},
"closed_at": 0,
"closest_task_at": 0,
"tags": {},
"custom_fields": {},
"contacts": {
"id": [
4573131
],
"_links": {
"self": {
"href": "/api/v2/contacts?id=4573131",
"method": "get"
}
}
},
"status_id": 20728261,
"sale": 1300,
"loss_reason_id": 0,
"pipeline": {
"id": 1251568,
"_links": {
"self": {
"href": "/api/v2/pipelines?id=1251568",
"method": "get"
}
}
},
"_links": {
"self": {
"href": "/api/v2/leads?id=1601345",
"method": "get"
}
}
},
{
"id": 1620709,
"name": "Тест2",
"responsible_user_id": 2600929,
"created_by": 2600929,
"created_at": 1531985076,
"updated_at": 1532061092,
"account_id": 20728252,
"is_deleted": false,
"main_contact": {
"id": 4614393,
"_links": {
"self": {
"href": "/api/v2/contacts?id=4614393",
"method": "get"
}
}
},
"group_id": 0,
"company": {},
"closed_at": 0,
"closest_task_at": 0,
"tags": {},
"custom_fields": {},
"contacts": {
"id": [
4614393
],
"_links": {
"self": {
"href": "/api/v2/contacts?id=4614393",
"method": "get"
}
}
},
"status_id": 20728261,
"sale": 2300,
"loss_reason_id": 0,
"pipeline": {
"id": 1251568,
"_links": {
"self": {
"href": "/api/v2/pipelines?id=1251568",
"method": "get"
}
}
},
"_links": {
"self": {
"href": "/api/v2/leads?id=1620709",
"method": "get"
}
}
}
]
}
}
Пытюсь получить данные name и sale
<?php
$url = '####/api/v2/leads?status=20728261';
$content = file_get_contents($url);
$json = json_decode($content, true);
foreach($json['_embedded']['items'] as $item) {
print $item['name'];
print $item['sale'];
}
?>
В чем ошибка?
Сделай так:
print_r( $json->_embedded->items );
Допиши в вопросе. Если это пусто будет, сделай так:
print_r( $json );
Оборудование для ресторана: новинки профессиональной кухонной техники
Частный дом престарелых в Киеве: комфорт, забота и профессиональный уход
Не получается в windows 10 получить список COM портов в comboBoxВ про файле прописал serialport, инклуды QSerialPort, QSerialPortInfo подключил
Подскажите, плизДелаю поиск в дереве, нахожу и возвращаю указатель, а он выдаёт ошибку