Орла
Области
Компаний
Пользователи
Галерея
Фиксированные новости
Орла
Отзывы о фирмах
Тарифы
Пользователи
Области
Банкоматы
Торговые точки
Доска объявлений
Курсы валют
Скидки
организации Орла
организации области
товары
сайты
сайты Орел
Данные
Разделы
Поиск
Поиск запросы
Статистика
Показы каталога организаций
Статистика клиенты
Пользователи
Сайты
Управление сайтом
Анкета
Аптеки
Афиша
Афиша новая
Баннеры
Бизнес >
Викторина
Голосование
Гость на сайте
Истории
Календарь событий
Каталоги >
Конкурс красоты
Конкурс аудио
Консультации
Меню
Новое на сайте
Новости >
Организации >
Программа ТВ
Публикации
Разделы сайта
Рассылка
Рестораны
Секрет фирмы >
Сервисы >
Ссылки
Тесты
Файловый менеджер
Форум
Фотогалерея
Обратная связь
Недвижимость
Новый год
Тексты
Пользователи
Юридический рейтинг
Отзывы на товары
Бан пользователей
Жалобы
Новые тесты
Коронавирус
Файловый менеджер
Имя файла
exceptionDetailsExample.php
Содержимое
<?php set_time_limit(0); date_default_timezone_set('UTC'); require __DIR__.'/../vendor/autoload.php'; /////// CONFIG /////// $username = ''; $password = ''; $debug = true; $truncatedDebug = false; ////////////////////// $ig = new \InstagramAPI\Instagram($debug, $truncatedDebug); try { $ig->login($username, $password); } catch (\Exception $e) { echo 'Something went wrong: '.$e->getMessage()."\n"; exit(0); } /* * The code below demonstrates how to get the full server response from an * InstagramException object (that's the ONLY type of exception which can * have an Instagram server response attached to it). * * All exceptions thrown by our library are derived from InstagramException. * And MOST of them (but NOT ALL) will have a server response object. So it's * important that you check hasResponse() before trying to use the response. */ // Example 1: Catching EVERYTHING derived from InstagramException so that you // can look at the server response (IF one is available). try { $ig->media->delete('123456'); // Invalid media ID, to trigger a server error. } catch (\InstagramAPI\Exception\InstagramException $e) { echo 'Something went wrong (InstagramException): '.$e->getMessage()."\n"; if ($e->hasResponse()) { // <-- VERY IMPORTANT TO CHECK FIRST! echo "The current exception contains a full server response:\n"; $e->getResponse()->printJson(); echo "Showing the 'did_delete' and 'message' values of the response:\n"; var_dump($e->getResponse()->getDidDelete()); var_dump($e->getResponse()->getMessage()); } } // Example 2: Catching the SPECIFIC exception you want (which must be derived // from InstagramException, otherwise it won't have hasResponse()/getResponse()). try { $ig->media->delete('123456'); // Invalid media ID, to trigger a server error. } catch (\InstagramAPI\Exception\EndpointException $e) { echo 'Something went wrong (EndpointException): '.$e->getMessage()."\n"; if ($e->hasResponse()) { // <-- VERY IMPORTANT TO CHECK FIRST! echo "The current exception contains a full server response:\n"; $e->getResponse()->printJson(); echo "Showing the 'did_delete' and 'message' values of the response:\n"; var_dump($e->getResponse()->getDidDelete()); var_dump($e->getResponse()->getMessage()); } // Bonus: This shows how to look for specific "error reason" messages in an // EndpointException. There are hundreds or even thousands of different // error messages and we won't add exceptions for them (that would be a // nightmare to maintain). Instead, it's up to the library users to check // for the per-endpoint error messages they care about. Such as this one: if (strpos($e->getMessage(), 'Could not delete') !== false) { echo "* The problem in this generic EndpointException was that Instagram could not delete the media!\n"; } } // With this knowledge, you can now go out and catch the exact exceptions you // want, and look at specific server details in the reply whenever necessary! // Note that the easiest way to handle the generic EndpointException (which is // triggered when any of the generic functions fail) is to do a string search in // $e->getMessage() to look for a specific error message to know what type of // error it was. And if you need more details about the error, you can THEN look // at $e->getResponse() to see the contents of the actual server reply.
/cron/instagram/vendor/mgp25/instagram-php/examples/
Имя
Дата
Размер
..
2019-01-15
assets
2019-01-15
README.md
2019-01-15
773 байт
accessingValues.php
2019-01-15
3 кб.
customSettings.php
2019-01-15
7 кб.
exceptionDetailsExample.php
2019-01-15
3 кб.
liveBroadcast.php
2019-01-15
4 кб.
paginateWithExclusion.php
2019-01-15
2 кб.
paginationExample.php
2019-01-15
2 кб.
pushReceiver.php
2019-01-15
2 кб.
rankTokenUsage.php
2019-01-15
2 кб.
realtimeClient.php
2019-01-15
5 кб.
realtimeHttp.php
2019-01-15
11 кб.
sharePhotoToStoryFeed.php
2019-01-15
2 кб.
shortcodeConverter.php
2019-01-15
819 байт
twoFactorLogin.php
2019-01-15
960 байт
uploadAlbum.php
2019-01-15
3 кб.
uploadPhoto.php
2019-01-15
2 кб.
uploadStory.php
2019-01-15
4 кб.
uploadStoryPoll.php
2019-01-15
3 кб.
uploadVideo.php
2019-01-15
2 кб.
/cron/instagram/vendor/mgp25/instagram-php/examples
Загрузить файлы
Файл 1
Файл 2
Файл 3