@feniksdv

Xml от yandexsearch вылетает ошибка, почему?

foreach ($xml as $key_xm => $xm){
                        echo '<pre>';
                        print_r($key_xm);
                        echo '</pre>';
                        $xml_[] .= $xm[$key_xm]->request->query;
                        for($group=0;$group<99;$group++) {
                            $xml_url[] .= $xm[$key_xm]->response->results->grouping->group[$group]->doc->url;
                        }
                    }


$xml

rray
(
    [0] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [version] => 1.0
                )

            [request] => SimpleXMLElement Object
                (
                    [query] => страхование промокод 2019
                    [page] => 0
                    [sortby] => rlv
                    [maxpassages] => 5
                    [groupings] => SimpleXMLElement Object
                        (
                            [groupby] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [attr] => d
                                            [mode] => deep
                                            [groups-on-page] => 100
                                            [docs-in-group] => 1
                                            [curcateg] => -1
                                        )

                                )

                        )

                )

            [response] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [date] => 20190509T140026
                        )

                    [reqid] => 1557410426168968-1652624763829553553316070-vla1-3635-XML
                    [found] => Array
                        (
                            [0] => 14477545
                            [1] => 14477545
                            [2] => 14477545
                        )

                    [found-human] => Нашлось 14 млн ответов
                    [results] => SimpleXMLElement Object
                        (
                            [grouping] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [attr] => d
                                            [mode] => deep
                                            [groups-on-page] => 100
                                            [docs-in-group] => 1
                                            [curcateg] => -1
                                        )

                                    [found] => Array
                                        (
                                            [0] => 1953
                                            [1] => 1953
                                            [2] => 1953
                                        )

                                    [found-docs] => Array
                                        (
                                            [0] => 7942369
                                            [1] => 7942369
                                            [2] => 7942369
                                        )

                                    [found-docs-human] => нашёл 8 млн ответов
                                    [page] => 0
                                    [group] => Array
                                        (
                                            [0] => SimpleXMLElement Object
                                                (
                                                    [categ] => SimpleXMLElement Object
                                                        (
                                                            [@attributes] => Array
                                                                (
                                                                    [attr] => d
                                                                    [name] => promokodus.com
                                                                )

                                                        )

                                                    [doccount] => 3672
                                                    [relevance] => SimpleXMLElement Object
                                                        (
                                                        )

                                                    [doc] => SimpleXMLElement Object
                                                        (
                                                            [@attributes] => Array
                                                                (
                                                                    [id] => ZAD35D953E908DBCC
                                                                )

                                                            [relevance] => SimpleXMLElement Object
                                                                (
                                                                )

                                                            [url] => https://promokodus.com/campaigns/vsk-strahovanie
                                                            [domain] => promokodus.com
                                                            [title] => SimpleXMLElement Object
                                                                (
                                                                    [hlword] => Array
                                                                        (
                                                                            [0] => Промокоды
                                                                            [1] => Страхование
                                                                            [2] => 2019
                                                                        )

                                                                )

                                                            [modtime] => 20160817T131236
                                                            [size] => 2030
                                                            [charset] => utf-8
                                                            [passages] => SimpleXMLElement Object
                                                                (
                                                                    [passage] => ВСК  –  и акции за май  года. Оформите  в компании с отличной репутацией на лучших условиях!
                                                                )

                                                            [properties] => SimpleXMLElement Object
                                                                (
                                                                    [_PassagesType] => 0
                                                                    [lang] => ru
                                                                )

                                                            [mime-type] => text/html
                                                            [saved-copy-url] => https://hghltd.yandex.net/yandbtm?lang=ru&fmode=inject&tm=1557410426&tld=ru&la=1557163776&text=%D1%81%D1%82%D1%80%D0%B0%D1%85%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5%20%D0%BF%D1%80%D0%BE%D0%BC%D0%BE%D0%BA%D0%BE%D0%B4%202019&url=https%3A%2F%2Fpromokodus.com%2Fcampaigns%2Fvsk-strahovanie&l10n=ru&mime=html&sign=708b889633289522a2f2d499152cf298&keyno=0
                                                        )

                                                )
.....


Все работает но, выдает ошибки

Warning: main(): Cannot add element yandexsearch number 1 when only 0 such elements exist in C:\xampp\htdocs\www\save_db.php on line 199

Warning: main(): Cannot add element yandexsearch number 1 when only 0 such elements exist in C:\xampp\htdocs\www\save_db.php on line 201

Warning: main(): Cannot add element yandexsearch number 1 when only 0 such elements exist in C:\xampp\htdocs\www\save_db.php on line 201

Warning: main(): Cannot add element yandexsearch number 1 when only 0 such elements exist in C:\xampp\htdocs\www\save_db.php on line 201

Warning: main(): Cannot add element yandexsearch number 1 when only 0 such elements exist in C:\xampp\htdocs\www\save_db.php on line 201

Warning: main(): Cannot add element yandexsearch number 1 when only 0 such elements exist in C:\xampp\htdocs\www\save_db.php on line 201

Warning: main(): Cannot add element yandexsearch number 1 when only 0 such elements exist in C:\xampp\htdocs\www\save_db.php on line 201

Warning: main(): Cannot add element yandexsearch number 1 when only 0 such elements exist in C:\xampp\htdocs\www\save_db.php on line 201

Warning: main(): Cannot add element yandexsearch number 1 when only 0 such elements exist in C:\xampp\htdocs\www\save_db.php on line 201
......
  • Вопрос задан
  • 94 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
24 июн. 2024, в 00:32
300 руб./за проект
23 июн. 2024, в 23:51
10000 руб./за проект
23 июн. 2024, в 23:27
5000 руб./за проект