$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'УРСОФЛОР 200мг' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/ursoflor.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Витазим № 20' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/03/vitazim-kapsula-sayt.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Тритвитрон' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2020/02/TRIVITRON-300x267.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Витасон' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/04/Vitason-reklam.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ВИТАСОН №30 (таблетки)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/vitason.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ИТАМИ №10 (мед. пластырь)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/rollup-itami.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'АКСЕТИН №10' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/400x400_54600.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'АНТРОЛИН крем ректальный 30г' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/Antrolin-1.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ТЕРМАРИ ФОРТЕ' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2020/01/1000-termry-1.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ЛИПОСОМ форте' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/1000-liposom.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ДЕВИЛОН 500 мг' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/devilon500mg№10tabletok.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Форсилакт' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/Forcylact.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ДЕ-СИЛОН 1гр' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2020/02/DeSilon-300x300.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ИМУТЕРРА №30 (таблетки)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/Имутерра-12.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'СЕДАЛИН №30 (капсулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/Sedalin-sayt.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Ferractin' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/04/Ferractin-kz.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Марвелокс 120 мл.' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/Marvelox-sayt.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Клеримед' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2020/01/klerimed-1000.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'БИОЗИМ №30 (капсулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/03/Biozyme-20-kapsul.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'К-ЭЛИКСИР 30 мл (капли)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/k-elixir.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Медоцеф' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2020/01/medocef-1000.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Сорензе 30 мл.' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/Sorenzo-sayt.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Медоклав №1' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2020/01/medoclav-1-1000.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Ferrius 30 ml.' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/Ferrius-box.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ДЕМИКАЛЬЦИН №30 (таблетки)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/demicalsin-box-sayt.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ВИТАЗИМ №30 (таблетки)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/Vitazim-brow-kz-cdr-17.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ДУПЛАКС' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2020/01/duplax-1000.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ЭВАДОЛ №60 (капсулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/evadol.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'THYOZIL' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/unicorn_52fb82779cb5a.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'New Product' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/02/logo-figo-en.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ИДРИНОЛ 100мг №10 (ампулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/8817755553822.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'РЕАФЕМ 200мг №30 (капсулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/reafem-1000.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ХОНДРОКОЛ 114 мл (крем)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/hondrokolkremdljasustavov114ml.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ФЛАМАКС 2мл №10 (ампулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/flamaks-1.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ИНЕСТОМ 5мл № 5 (ампулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/Инестом-брошюра-23.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'РОГАМ' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2020/01/rogham-1000.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ЭНЕРДЖИ №30 (таблетки)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/energy-box-sayt.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'КИДАКТИВИТ 120 мл сироп с лецитином' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/02/Kidactivit-syrop.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'МЕДОКЛАВ 156,25 мг/5 мл' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/medoclav-156.25.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ДУЕВАГ' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2020/01/Duevag.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Л-ЭЛИКСИР 30 мл (капли)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/02/L-elixir_003.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Марибиол для детей' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/02/Maribiol-kids-brashura-2.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Оргензим № 30' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/04/ORGENZYME-BANKA.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ВИТАМИН С №20 (шипучие таблетки)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/vit-c.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ДемиФлекс сироп' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/DemiFlex-.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'БИОЗИМ №30 (капсулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/03/Biozyme-20-kapsul.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Липосом форте' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2020/01/a25f4f58938bbe61357ebca42d23866f.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ЗИБАН 1000 мг' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/Ziban-flyer.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'МЕДОКЛАВ 312,5 мг/5 мл' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/Medoclav-roll-up.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Спектрум № 30' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/03/Spektrum-kz-kor-копия.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ХОНДРОКОЛ №60 (капсулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/CHONDROCOL-KZ-NEW.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'АМЕЛОТЕКС 15мг таб№20 (таблетки)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/ameloteks-tab-15mg-n20.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Демикальцин 200 мл.' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/demicalcin-syrop.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'МЕДОКЛАВ 1000 мг' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/tmp_add_image_652.jpeg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ИНЕСТОМ 1г / 10мл №10 (суспензия)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/Инестом-брошюра-2.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'АМЕЛОТЕКС 1,5мг амп №5 (ампулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/ead9eeceaeb6d2beaeacd312970c764f.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Цереброкс 120 мл.' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/cerebrox.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ГИАЛОФЕМ 30г (туба)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/gialofem.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'АЛФИНОР' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/400x400_50819.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'АПОНИЛ №30 (таблетки)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/aponil.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Берноли 120 мл.' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/Bernoli-1.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'МЕДОКЛАВ 625 мг' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/tmp_add_image_511.jpeg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'АЛМИРАЛ №5 (ампулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/Алмирал.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ТРИКОРТИН №5 2 мл (ампулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/trikortin-1000.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Эйропол 20 мл.' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/01/airopol.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'РЕАФЕМ 100мг №30 (капсулы)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/Reafem-100.jpg';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'Феррактин' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2018/04/Ferractin-kz.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );


$result = get_posts( array( 'post_type' => 'product-card','post_title' => 'ГИАЛГАН 20мг/2мл №1 (шприц)' ) );

$url = 'https://altespharm.kz/wp-content/uploads/2019/11/806434954.png';

$post_id = $result[0]->ID;

$tmp = download_url( $url );

$file_array = [

'name' => basename( $url ), // ex: wp-header-logo.png

'tmp_name' => $tmp,

'error' => 0,

'size' => filesize($tmp),

];

$id = media_handle_sideload( $file_array, $post_id, $desc );

if( is_wp_error( $id ) ) {

@unlink($file_array['tmp_name']);

return $id->get_error_messages();

}

@unlink( $tmp );