Example #1
0
                    if ($value_category->use_url) {
                        $url .= $value_category->url;
                    }
                    $html = file_get_html($url);
                    if (!is_null($html)) {
                        $temp['url'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->url->html), $config->item->url->element);
                        $temp['title'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->title->html), $config->item->title->element);
                        $temp['width_image'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->width_image->html), $config->item->width_image->element);
                        $temp['height_image'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->height_image->html), $config->item->height_image->element);
                        $temp['image'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->image->html), $config->item->image->element);
                        $temp['alt_image'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->alt_image->html), $config->item->alt_image->element);
                        $temp['description'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->description->html), $config->item->description->element);
                        $temp['date_publication'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->date_publication->html), $config->item->date_publication->element);
                        $temp['author'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->author->html), $config->item->author->element);
                        $data = json_encode($temps);
                        $article->setArticle($data);
                        die('Scrap one article');
                    }
                }
            } else {
                echo "Categories Not Found For " . $url;
            }
        }
    } else {
        echo "Websites Not Found";
    }
} else {
    echo "BDD ERROR : " . json_encode($bdd);
    echo "TABLES ERROR : " . json_encode($_TABLES);
}
function getElement($data, $element)