How can i catch the errors of these functions.
When running on the backend you can see if something fails but since php I do not know how I can catch those error messages or that the operation has been a success.
function loadProductsPost() {
$_POST = array (
'tab' => 'AdminImport',
'skip' => '1',
'csv' => 'productos.csv',
'forceIDs' => '0',
'match_ref' => '1',
'convert' => '',
'entity' => '1',
'separator' => ';',
'multiple_value_separator' => ',',
'iso_lang' => 'es',
'import' => 'Importar datos CSV',
'type_value' =>
array (
0 => 'category',
1 => 'name',
2 => 'description_short',
3 => 'reference',
4 => 'ean13',
5 => 'weight',
6 => 'wholesale_price',
7 => 'price_tex',
8 => 'ecotax',
9 => 'manufacturer',
10 => 'image',
),
);
}
$import = New AdminImportController();
loadProductsPost();
$import->productImport();
//______________________________________CATEGORIAS
function loadCategoriesPost() {
$_POST = array (
'tab' => 'AdminImport',
'skip' => '1',
'csv' => 'categorias.csv',
'forceIDs' => '1',
'convert' => '',
'entity' => '0',
'separator' => ';',
'multiple_value_separator' => ',',
'iso_lang' => 'es',
'import' => 'Importar datos CSV',
'type_value' =>
array (
0 => 'id',
1 => 'active',
2 => 'name',
3 => 'parent',
4 => 'is_root_category',
5 => 'description',
6 => 'meta_title',
7 => 'meta_keywords',
8 => 'meta_description',
9 => 'link_rewrite',
10 => 'image',
),
);
}
$import = New AdminImportController();
loadCategoriesPost();
$import->categoryImport();