Инструменты для захвата и конвертирования Интернета
Интернет-сообщество GrabzIt

Обновление до v3.4.5 - ошибки

Задайте вопросы о том, как захватывать или конвертировать веб-страницы или HTML into изображения, CSV, PDF или DOCX документы, а также о том, как конвертировать видео into анимированные GIF с использованием нашего API.

Две проблемы:

(1) When installing via Composer the folder structure is very different and is missing many subfolders such as "ajax", "css", etc. Are these not needed when using Grabzit only from the server side (php)?

(2) After downloading the php client I notice the classes are named differently (previously I had "require_once 'vendor/GrabzIt/lib/GrabzItClient.класс.php';" but now it's "require_once 'vendor/GrabzIt/lib/GrabzItClient.php';"). However, when I try to generate a PDF using this code:

// Create the GrabzItClient class
$grabzIt = new GrabzItClient(GRABZIT_APP_KEY, GRABZIT_APP_SECRET);
$pdfOptions = new GrabzItPDFOptions();

Я получаю сообщение об ошибке:

[17-Jan-2021 11:12:26 America/Toronto] PHP Fatal error: Cannot declare class GrabzIt\GrabzItClient, because the name is already in use in /Users/Ross/Dropbox/htdocs/wonderfest_mamp_pro/private/contest/include/vendor/GrabzIt/lib/GrabzItClient.php on line 11

I really want to use v3.4.5 but this is blocking my development.

Asked by Ross Waddell on the 17th of January 2021

It sounds like you are using the legacy version of the PHP  library we moved to using namespaces etc about two and a half years ago. The 3.4.5 legacy version is available on the download page for a manual download.

The legacy version will not be made available on composer as it is only being kept for backwards compatibility. The ajax and css folders are not included as they are part of the demo application and not the library.

If you want to move to the latest version the examples in the PHP документация should help the changes are relatively minor.





Ответ от службы поддержки GrabzIt от 17 января 2021 г.

I installed via Composer but when I go to generate my PDF I get a new error:


// Create the GrabzItClient class
$grabzIt = new \GrabzIt\GrabzItClient(GRABZIT_APP_KEY, GRABZIT_APP_SECRET);
$pdfOptions = new \GrabzIt\GrabzItBaseOptions();



[17-Jan-2021 13:10:49 America/Toronto] PHP Fatal error: Uncaught Error: Call to undefined method GrabzIt\GrabzItBaseOptions::setPageSize() in /Users/Ross/Dropbox/htdocs/wonderfest_mamp_pro/private/contest/include/createPDF.php:120


Answered by Ross Waddell on the 17th of January 2021

You have initialized a GrabzItBaseOptions instead of GrabzItPDFOptions

Ответ от службы поддержки GrabzIt от 17 января 2021 г.