Exemplo n.º 1
0
 public function salidas($tipo = 'nacional')
 {
     $curl = new Curl();
     $paramsCurl = array();
     $paramsCurl['da'] = 'd';
     if ($tipo == 'nacional') {
         $paramsCurl['in'] = 'n';
     }
     if ($tipo == 'internacional') {
         $paramsCurl['in'] = 'i';
     }
     $curl->get(URL_AICM, $paramsCurl);
     $hunter = new DomHunter();
     $hunter->strHtmlObjetivo = $curl->response;
     $columnas = array('origen', 'aerolinea', 'vuelo', 'hora', 'estatus', 'sala', 'terminal');
     $arrayPresas[] = array('salidas', new Tabla(array('ocurrencia' => 1), $columnas));
     $hunter->arrPresas = $arrayPresas;
     $hunted = $hunter->hunt();
     array_pop($hunted['salidas']);
     return $hunted;
 }
Exemplo n.º 2
0
$presas[] = array('destino', new KeyValue('destino', TRUE, TRUE));
$presas[] = array('cp_destino', new IdUnico(5, 'num'));
$presas[] = array('servicio', new KeyValue('entrega garantizada', FALSE));
$presas[] = array('estatus', new NodoDom(array('find' => '.respuestasazul'), 'plaintext', 1));
$presas[] = array('fecha_recoleccion', new KeyValue('fecha de recoleccion'));
$presas[] = array('fecha_programada', new KeyValue('de entrega', TRUE, TRUE));
$presas[] = array('fecha_entrega', new KeyValue('Fecha y hora de entrega'));
$presas[] = array('tipo_envio', new KeyValue('tipo de envio'));
$presas[] = array('peso', new KeyValue('Peso kg'));
$presas[] = array('peso_vol', new KeyValue('Peso volumétrico kg'));
$presas[] = array('recibio', new KeyValue('recibi'));
$presas[] = array('dimensiones', new KeyValue('Dimensiones cm'));
$columnas = array('fecha', 'lugar_movimiento', 'comentarios');
$presas[] = array('historial', new Tabla(array('ocurrencia' => -1), $columnas, 3));
$hunter->arrPresas = $presas;
$hunted = $hunter->hunt();
echo '<pre>';
var_dump($hunted);
echo '</pre>';
/*
$coords = geocoder::getLocation($ciudad_origen . ", Mexico");
if ($coords != false) {
   $latitudOrigen = $coords['lat'];
   $longitudOrigen = $coords['lng'];
} else {
   $latitudOrigen = "";
   $longitudOrigen = "";
}
$ciudadDestino = trim(str_replace('&nbsp;', '', $html->find('text', 80)->plaintext));
$coords = geocoder::getLocation($ciudadDestino . ", Mexico");
if ($coords != false) {
Exemplo n.º 3
0
 public function cotizacion($cp_origen = NULL, $cp_destino = NULL, $tipo = 'sobre', $peso = NULL, $alto = NULL, $largo = NULL, $ancho = NULL)
 {
     if (!$cp_origen) {
         return array('mensaje_error' => 'Falta el parametro "cp_origen"', 'error' => 3);
     }
     if (!$cp_destino) {
         return array('mensaje_error' => 'Falta el parametro "cp_destino"', 'error' => 4);
     }
     if (!preg_match("/^[0-9]{5}\$/", $cp_origen) || !preg_match("/^[0-9]{5}\$/", $cp_destino)) {
         return array('mensaje_error' => 'No es un codigo postal de origen o destino valido', 'error' => 5);
     }
     $params_peticion = array('CPOrigen' => $cp_origen, 'CPDestino' => $cp_destino, 'Tipo' => $tipo, 'cTipoEnvio' => $tipo);
     # Paquetes
     if ($tipo == 'paquete') {
         if (!$peso) {
             return array('mensaje_error' => 'Falta el parametro "peso" para cotizar paquetes', 'error' => 6);
         }
         if (!$alto) {
             return array('mensaje_error' => 'Falta el parametro "alto" para cotizar paquetes', 'error' => 7);
         }
         if (!$largo) {
             return array('mensaje_error' => 'Falta el parametro "largo" para cotizar paquetes', 'error' => 8);
         }
         if (!$ancho) {
             return array('mensaje_error' => 'Falta el parametro "ancho" para cotizar paquetes', 'error' => 9);
         }
         $params_peticion['Peso'] = $peso;
         $params_peticion['Alto'] = $alto;
         $params_peticion['Largo'] = $largo;
         $params_peticion['Ancho'] = $ancho;
     }
     # Busca dom
     $hunter = new DomHunter(URL_COTIZAR, 1);
     $hunter->arrParamsPeticion = $params_peticion;
     $presas = array();
     $columnas = array('producto', 'peso_kg', 'tarifa_guia', 'tarifa_combustible', 'cargos_extra', 'sobrepeso_costo', 'sobrepeso_combustible', 'costo_total');
     $presas[] = array('costos', new Tabla(array('ocurrencia' => -1), $columnas, 10, true));
     $hunter->arrPresas = $presas;
     $hunted = $hunter->hunt();
     return $hunted;
 }
Exemplo n.º 4
0
<?php 
require_once '../vendor/autoload.php';
require_once '../src/Ivansabik/DomHunter/DomHunter.php';
use Ivansabik\DomHunter\DomHunter;
use Ivansabik\DomHunter\Tabla;
$hunter = new DomHunter('http://www.misprofesores.com/profesores/EDUARDO-TOMAS-ARELLANO-ARJONA_17865');
$columnas = array('fecha ', 'clase', 'facilidad', 'ayuda', 'claridad', 'icon1', 'icon2', 'comentarios', 'palomin');
$presas[] = array('calificaciones', new Tabla(array('ocurrencia' => 6), $columnas, 2));
$hunter->arrPresas = $presas;
$out = $hunter->hunt();
var_dump($out);
$hunter = new DomHunter('http://www.misprofesores.com/profesores/EDUARDO-TOMAS-ARELLANO-ARJONA_17865?pag=2');
$hunter->arrPresas = $presas;
$out = $hunter->hunt();
var_dump($out);
$hunter = new DomHunter('http://www.misprofesores.com/profesores/EDUARDO-TOMAS-ARELLANO-ARJONA_17865?pag=3');
$hunter->arrPresas = $presas;
$out = $hunter->hunt();
var_dump($out);
$hunter = new DomHunter('http://www.misprofesores.com/profesores/EDUARDO-TOMAS-ARELLANO-ARJONA_17865?pag=4');
$hunter->arrPresas = $presas;
$out = $hunter->hunt();
var_dump($out);
$hunter = new DomHunter('http://www.misprofesores.com/profesores/EDUARDO-TOMAS-ARELLANO-ARJONA_17865?pag=5');
$hunter->arrPresas = $presas;
$out = $hunter->hunt();
var_dump($out);
$hunter = new DomHunter('http://www.misprofesores.com/profesores/EDUARDO-TOMAS-ARELLANO-ARJONA_17865?pag=6');
$hunter->arrPresas = $presas;
$out = $hunter->hunt();
var_dump($out);