Esempio n. 1
0
<?php

// This is the scrapper of WUSS
// Author : Quentin BELOT
require_once dirname(__FILE__) . "/php/simple_html_dom.php";
global $bdd;
global $_TABLES;
if (!is_null($bdd) && !is_null($_TABLES)) {
    $website = new Website($bdd, $_TABLES);
    $websites = $website->getWebsites();
    if (!is_null($websites)) {
        foreach ($websites as $key_website => $value_website) {
            $category = new Category($bdd, $_TABLES);
            $categories = $category->getCategories($value_website->id);
            $url = $value_website->url;
            $file = $value_website->file;
            // Try to load json config
            $config = null;
            $json = file_get_contents($file);
            if ($json !== false) {
                // if Valid Config
                $config = json_decode($json);
            } else {
                // Invalid Config
                echo "Website File Not Found";
            }
            if (!is_null($categories)) {
                foreach ($categories as $key_category => $value_category) {
                    $article = new Article($bdd, $_TABLES);
                    if ($value_category->use_url) {
                        $url .= $value_category->url;