<?php
class ControllerToolCron extends Controller{

    public function index()
    {
        if ($_SERVER['HTTPS']) {
            $server = 'https://' . $_SERVER['SERVER_NAME'];
        } else {
            $server = 'http://' . $_SERVER['SERVER_NAME'];
        }

        $ch = curl_init('https://www.deercase.com/index.php?route=tool/yurtici_cron');
        //curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $results = curl_exec($ch);
        curl_close($ch);

        $log = new Log("YurticiKargoCronResultLog.txt");
        $log->write($results);

    }

    private function cronCurl($url)
    {
        $ch = curl_init($url);
        //curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $results = curl_exec($ch);
        curl_close($ch);

    }

    public function uppercase_ps()
    {
        /*
        $query = $this->db->query("SELECT * FROM ps_nebim_district ")->rows;
        foreach ($query as $row){
            $name = '';
            $name =  mb_convert_case($row['district_description'], MB_CASE_TITLE , "UTF-8");
            $this->db->query("UPDATE ps_nebim_district SET district_description = '". $this->db->escape($name) ."' WHERE nebim_district_id = '". $row['nebim_district_id'] ."' ");
        } */

    /*
        $query = $this->db->query("SELECT * FROM ps_district ")->rows;
        foreach ($query as $row){
            $name = '';
            $name =  mb_convert_case($row['district_name'], MB_CASE_TITLE , "UTF-8");
            $this->db->query("UPDATE ps_district SET district_name = '". $this->db->escape($name) ."' WHERE district_id = '". $row['district_id'] ."' ");
        }

    */



    }

}