| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <?php
- require 'shared/extraeInfo.php';
- $accesoPortal = new AccesoPortal();
- error_reporting(0);
- if (isset($_POST['compare'])) {
- $arrComparador = json_decode($_POST['compare'],true);
- $arrJson = $_POST['compare'];
- if (!empty($arrComparador)) {
- foreach ($arrComparador as $key => $datos) {
- foreach ($datos as $key => $detalles) {
- $idx = $detalles['Id'];
- $model = $detalles['Model'];
- $serie = $detalles['codSerie'];
- $categoria = $detalles['catId'];
- $imagen = $accesoPortal->compara($model,$idx,$serie,$categoria);
- }
- }
- ?>
- <div class="row">
- <div id="compare" class="section">
- <div class="container title-only">
- <div class="row">
- <div class="col-md-12 section-title">
- <h2 id="compare-fans-header">Comparar ventiladores</h2>
- <hr>
- </div>
- </div>
- <div class="saved-container">
- <div class="row">
- <div class="col-md-5">
- <div class="saved-chart-container" style="margin-bottom:30px">
- <?php if(!empty($imagen)) echo $imagen; ?>
- </div>
- </div>
- <div class="col-md-7">
- <div class="saved-grid-container">
- <table id="saved-grid" style="width:100%;" class="table table-hover table-striped dt-responsive no-wrap">
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script>
- if (compareEnabled) {
- $j("#saved-grid").DataTable({
- language: {
- url: 'js/0.js'
- },
- searching: false,
- lengthChange: false,
- data: [],
- responsive: {
- details: {
- type: 'column'
- },
- },
- rowId: 'RowId',
- columns: [
- {
- title: "", data: "Id", orderable: false, render: function (data, type, full, meta) {
- return "<a class=\"delete-saved\" style=\"cursor: pointer;\" onclick=\"removeFan(" + data + ")\" data-val=\"" + data + "\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i></a>";
- }
- },
- { data: "Model", title: ColumnCode, visible: true },
- { data: "Description", title: ColumnDescription, visible: true }
- /*{
- title: "", data: "Id", orderable: false, render: function (data, type, full, meta) {
- return "<a style=\"cursor: pointer;\" class='tree quickview btn btn-primary btn-xs' data-val=\"" + data + "\"><i class=\"fa fa-search\" aria-hidden=\"true\"></i> " + ViewStr + "</a>";
- // return ;
- }
- }*/
- ]
- });
- var $grid = $j('#saved-grid').DataTable();
- $grid.clear();
- //pasamos el array de php a Js
- var datos = '<?php echo $arrJson ?>';
- //le damos formato tipo json
- var res = datos.split('"').join("'");
- var json = JSON.stringify(eval("(" + res + ")"));
- arrToJson = JSON.parse(json);
- //los agregamos a la tabla
- for (var i = 0; i < arrToJson.datos.length; i++) {
- $grid.row.add(arrToJson.datos[i]).draw();
- }
- //desaparecer comparador si no tenemos datos
- if (Object.keys(arrToJson.datos).length === 0) {
- $j("#comparador").hide();
- }
- }
- </script>
- <?php
- }
- }
- //Imprimimos el modelo en 3D
- if (isset($_POST['url'])) {
- $url = trim($_POST['url']);
- //Mandamos a llamar el método getTablas
- $accesoPortal->buscarInfo($url);
- }
- // Extraer la tabla de modelos
- if (isset($_POST['table'])) {
- $url = $_POST['table'];
- extraerTabla($url);
- }
- function extraerTabla($url)
- {
- //echo $url;
- for ($i = 0; $i <= 5; $i++) {
- $arrProxies[0] = '187.188.168.57:9991';
- $arrProxies[1] = '148.217.94.54:3128';
- $arrProxies[2] = '187.189.96.94:9991';
- $arrProxies[3] = '187.162.11.94:3128';
- $arrProxies[4] = '177.234.0.218:43173';
- $arrProxies[5] = '187.178.238.177:3629';
- $proxy = $arrProxies[$i];
- $proxy = explode(":", $proxy);
- $ch = curl_init($proxy[0]);
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $data = curl_exec($ch);
- $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
- if ($httpcode >= 200 && $httpcode < 300) {
- $proxyN = 'tcp://' . $arrProxies[$i];
- $context = array(
- 'http' => array(
- 'proxy' => $proxyN,
- 'request_fulluri' => True,
- ),
- );
- $context = stream_context_create($context);
- $contenido = file_get_contents($url, False, $context);
- if ($contenido) {
- $tablaHTML = "<div class='section section-grey'>";
- $seccionGris = strstr($contenido, "section section-grey");
- $removeFooter = strstr($seccionGris, "section cookie-warning", true);
- $tablaHTML .= ("<div class=\" " . $removeFooter . "\" >");
- $tablaHTML .= "</div>";
- echo $tablaHTML;
- } else {
- echo "<p style='text-align: center;'>El contenido no fue cargado correctamente, recargue la página.</p>";
- // $archivoActual = $_SERVER['PHP_SELF'];
- // header("refresh:1;url=".$archivoActual." ");
- }
- break;
- } else {
- $i = 0;
- }
- }
- curl_close($ch);
- }
- ?>
|