PHP code example of macropage / idealo-business-api
1. Go to this page and download the library: Download macropage/idealo-business-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
macropage / idealo-business-api example snippets
use IdealoBusiness\IdealoBusinessConnector;
use IdealoBusiness\Data\ClickReportStatus;
$idealo = new IdealoBusinessConnector(
clientId: getenv('IDEALO_CLIENT_ID'),
clientSecret: getenv('IDEALO_CLIENT_SECRET'),
);
// First request triggers auto-auth via boot(). You can also call it explicitly:
$idealo->authenticateWithClientCredentials();
// idealo returns the shop_id directly in the token response for single-shop credentials:
$shopId = $idealo->getAuthenticatedShopId();
$response = $idealo->clickReports()->download($shopId, $reportId);
// Always treat this as binary. Do NOT call ->json().
file_put_contents("report_{$reportId}.zip", $response->body());
$zip = new ZipArchive();
$zip->open("report_{$reportId}.zip");
$csv = $zip->getFromIndex(0);