Herramientas para capturar y convertir la web
Comunidad en línea de GrabzIt

Actualización a v3.4.5 - errores

Dos cuestiones:

(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.clase.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();

I get an error message:

[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.

Pregunta de Ross Waddell el 17 de enero de 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 Documentación de PHP should help the changes are relatively minor.





Respondido por GrabzIt Support el 17 de enero de 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

Respondido por GrabzIt Support el 17 de enero de 2021