function __construct()
 {
     $this->db = DatabaseFactory::getDatabase();
     $this->de = new WarOfNationsDataExtractor($this->db);
     // We always need authentication, so just initialize it now
     $this->auth = new WarOfNationsAuthentication($this->db, $this->de, $this->data_load_id);
 }
Beispiel #2
0
// Kijkt dat file bestaat
if ($csvParser->checkIfFileExist()) {
    // Lees regel CSV bestand
    $row = 0;
    $dataArray = [];
    if ($csvParser->setHandle($csvParser->openFile("r")) !== FALSE) {
        // Controleert of data is gevonden
        while (($data = $csvParser->lineCSV($csvParser->getHandle())) !== FALSE) {
            if ($row == 0) {
                $row++;
                continue;
            }
            $num = count($data);
            // Zet regel op het scherm
            echo "<p> {$num} velden in lijn {$row}: <br /></p>\n";
            $database = DatabaseFactory::getDatabase();
            $user = new UserController(new DbUser($database));
            $user->setFirstName($data[DATA_POS_FN]);
            $user->setLastName($data[DATA_POS_LN]);
            $user->setMobile($data[DATA_POS_MOB]);
            $user->setTelephone($data[DATA_POS_TEL]);
            echo $user->getFirstName() . "<br/>";
            echo $user->getLastName() . "<br/>";
            echo $user->getMobile() . "<br/>";
            echo $user->getTelephone() . "<br/>";
            // Check lengte en start met 0
            // check mobile nummers
            if (strlen($data[DATA_POS_MOB]) != MOB_LENGTH || substr($data[DATA_POS_MOB], 0, 1) != "0") {
                // Als er een fout is schrijf naar foutbestand negeert het als het er al instaat
                if ($logger->checkInFile($loggerUri, $data) == false) {
                    $logger->writeInFile($loggerUri, $data);
<?php

require_once dirname(__FILE__) . '/classes/data/DatabaseFactory.class.php';
require_once dirname(__FILE__) . '/classes/data/Proxy.class.php';
$debug = false;
// This is the page that that we're going to request going through the proxy
$testpage = "http://gcand.gree-apps.net/hc//index.php/json_gateway";
$checktext = "Json_gateway?svc=";
// This loads all the proxies from the file into an array
$db = DatabaseFactory::getDatabase();
//$proxies = ProxyDAO::getActiveProxies($db);
// Test each of our proxies 10 times
for ($i = 0; $i < 10; $i++) {
    // Reload the proxy list each time through in case we've deactivated something - this will speed up testing.
    $proxies = ProxyDAO::getActiveProxies($db);
    // Here we loop through each cell of the array with the proxies in them testing each one until we get to the end of the array
    foreach ($proxies as $proxy) {
        // Concatenate the proxy string
        $proxy_str = "{$proxy['ip_address']}:{$proxy['port']}";
        // This script utilizes cURL which is library you can read more about
        //using curl in my intro tutorials
        // starting curl and setting the page to get
        $ch = curl_init($testpage);
        // sets the proxy to go through
        curl_setopt($ch, CURLOPT_PROXY, $proxy_str);
        if ($proxy['type'] == 'SOCKS') {
            curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
        }
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);