laravelrus / vk-client Goto Github PK
View Code? Open in Web Editor NEWPHP client for Vk.com API
License: MIT License
PHP client for Vk.com API
License: MIT License
Здравствуйте. Есть проблема с парсингом API vk.com на Laravel 5.3
Вот вид моего виджета NewsVK:
public function run()
{
$api = new Client;
$wallget = $api->request('wall.get', [
'owner_id' => '-12370608',
'domain' => 'realtatish',
'filter' => 'all',
'offset' => '0',
'count' => '5'
]);
$wallget = $wallget["response"]["items"];
foreach($wallget as $i) {
echo '<pre>';
var_dump($i["is_pinned"]);
}
return view("widgets.news_v_k", [
'wallget' => $wallget,
'config' => $this->config,
]);
}
Из массива нормально парсяться поля ["text"], ["date"], но когда пытаюсь или через foreach вывести или же просто указывать как переменную $attachments = $i["attachments"] (в шаблоне конечно через foreach вывод идёт), но при упоминании полей ["attachments"] или ["is_pinned"] вываливается ошибка Undefined index: is_pinned
Подскажите пожалуйста как проверять наличие поля ["attachments"]? Я так понимаю это из-за того, что некоторые посты содержать прикреплённые файлы, а некоторые нет, надо тогда отлавливать название этого массива вложенного?!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.