Zwiększenie poziomu raportowania błędów w product.php oraz poprawa formatowania kodu w cron.php

This commit is contained in:
2024-12-17 21:30:40 +01:00
parent b72859aa15
commit d993d53002
2 changed files with 8 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
<?php <?php
error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED );
$ROOT_DIR = $_SERVER['DOCUMENT_ROOT']; $ROOT_DIR = $_SERVER['DOCUMENT_ROOT'];
require_once $ROOT_DIR . '/config.php'; require_once $ROOT_DIR . '/config.php';

View File

@@ -83,7 +83,8 @@ function parseOrlenAddress( $input )
} }
} }
function getImageUrlById($id) { function getImageUrlById ($id )
{
$apiUrl = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['SERVER_NAME'] . '/api/v1/product.php'; $apiUrl = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['SERVER_NAME'] . '/api/v1/product.php';
$ch = curl_init(); $ch = curl_init();
@@ -91,13 +92,14 @@ function getImageUrlById($id) {
curl_setopt($ch, CURLOPT_URL, $apiUrl . '?id=' . urlencode($id)); curl_setopt($ch, CURLOPT_URL, $apiUrl . '?id=' . urlencode($id));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json', 'Content-Type: application/json',
)); ));
$response = curl_exec($ch); $response = curl_exec($ch);
if ($response === false) { if ( $response === false )
curl_close($ch); {
return null; curl_close($ch);
return null;
} }
curl_close($ch); curl_close($ch);