function put_ini_file($file, $array, $i = 0)
{
    $str = "";
    foreach ($array as $k => $v) {
        if (is_array($v)) {
            $str .= str_repeat(" ", $i * 2) . "[{$k}]" . PHP_EOL;
            $str .= put_ini_file("", $v, $i + 1);
        } else {
            $str .= str_repeat(" ", $i * 2) . "{$k} = {$v}" . PHP_EOL;
        }
    }
    if ($file) {
        return file_put_contents($file, $str);
    } else {
        return $str;
    }
}
    $http->get($site_url, true);
}
$ref_shop = '';
try {
    $DOM = new DOMDocument();
    include $script;
} catch (Exception $e) {
    echo "Procesando url: " . $my_url . "<br />";
    echo "Caught Exception (" . $e->getMessage() . ")\n{$e}\n";
} finally {
    if (count($url_array) > 0) {
        file_put_contents("file/url_list.ccd", "");
        while (count($url_array) > 0) {
            $my_url = array_shift($url_array);
            file_put_contents("file/url_list.ccd", $my_url . PHP_EOL, FILE_APPEND);
        }
    }
}
//echo "<br />";
//opcciones finales
$http->close();
$configuracion['variables']['ref_count'] = $reference_count;
$achivo_contenido = ";<?php die(); ?>" . PHP_EOL . put_ini_file(null, $configuracion);
file_put_contents('crawler.conf.php', $achivo_contenido);
echo "<p>Se han procesado {$count_success} urls correctamente</p>";
echo "<p>" . $count_failed . " urls han fallado.</p>";
echo "<a class='btn-type' href='./actualproccesview.php'>Ver Resultados</a>";
echo "<a class='btn-type' href='./pageCrawler.php'>Seguir procesando</a>";
?>