Example #1
0
                     $latitude = $meta->getAttribute('content');
                 } else {
                     if ($meta->getAttribute('property') == 'booking_com:location:longitude') {
                         $longitude = $meta->getAttribute('content');
                     }
                 }
             }
             if (isset($longitude) && isset($latitude)) {
                 updateDireccionByHotelId($hotel->id, array('lat' => $latitude, 'lon' => $longitude));
             }
         }
     }
     $data_hotel = array('descripcionLarga' => json_encode($descripciones_largas_array), 'nombre' => $nombreHotel, 'calidad' => (int) $rating);
     updateHotelData($hotel->id, $data_hotel);
     foreach ($servicios_array as $servicio) {
         inserHotelServicio(array('categoria' => json_encode($servicio['categoria']), 'servicio' => json_encode($servicio['servicio'])), $hotel->id);
     }
     foreach ($condiciones_array as $servicio) {
         inserHotelCondicion(array('categoria' => json_encode($servicio['categoria']), 'servicio' => json_encode($servicio['servicio'])), $hotel->id);
     }
     inserHotelTenerEnCuenta(json_encode($tener_en_cuenta_array), $hotel->id);
 } else {
     deleteHotelImages($hotel->id);
     $url = $hotel_url;
     $contexto = stream_context_create($opciones);
     $content = file_get_contents($url, false, $contexto);
     $html = str_get_dom($content);
     $photos = $html('#photos_distinct a');
     foreach ($photos as $e_k => $element) {
         $imagen = array();
         $ruta = false;
Example #2
0
$hotel = array('descripcionLarga' => $descripcion_larga, 'url' => $hotel_url, 'estado' => 'activo', 'visitas' => 0, 'nombre' => $nombre, 'calidad' => (int) $rating);
$hotel_id = insertHotel($hotel);
foreach ($imagenes as $imagen) {
    insertHotelImage($imagen, $hotel_id);
}
//Servicios!
$servicios = $html('.nha_single_unit_facilities .description');
$servicios_array = array();
foreach ($servicios as $servicio) {
    $servicio_t = $servicio('h3');
    $servicio_t = $servicio_t[0]->getPlainText();
    $servicio_p = $servicio('p');
    $servicio_p = $servicio_p[0]->getPlainText();
    $servicios_text = split(',', trim($servicio_p));
    foreach ($servicios_text as $servicio_text) {
        inserHotelServicio(array('categoria' => trim($servicio_t), 'servicio' => trim($servicio_text)), $hotel_id);
    }
}
//Mapa!
$metas = $html('meta');
$latitude = 28.358744;
$longitude = -14.053676;
foreach ($metas as $meta) {
    if ($meta->getAttribute('property') == 'booking_com:location:latitude') {
        $latitude = $meta->getAttribute('content');
    } else {
        if ($meta->getAttribute('property') == 'booking_com:location:longitude') {
            $longitude = $meta->getAttribute('content');
        }
    }
}