https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/serbaantik.com/public_html/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/serbaantik.com/public_html/application/controllers/Cron_update_products.php
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Cron_update_products extends Public_Controller 
{
		public function __construct() 
		{   
				parent::__construct();   
		}

		public function update_stocks()  
		{  
				 
				$method = 'POST'; 
				$headers = array();
				$headers[] = 'Content-Type: application/json';
				$headers[] = 'Authorization: Bearer 3d9stGmMgXqrd4wKliC82N6onh5AMqgX';

				$ch = curl_init();
				curl_setopt($ch, CURLOPT_URL, 'http://203.77.209.141/rest/api/getDataUpdate');
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
				curl_setopt($ch, CURLOPT_ENCODING, '');
				curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
				curl_setopt($ch, CURLOPT_TIMEOUT, 0);
				curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
				curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
				curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
				curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
				curl_setopt($ch, CURLOPT_POSTFIELDS, '');
				$result = curl_exec($ch); 
      	curl_close($ch);

      	$response_data = json_decode($result);
				$products = $response_data->raw_content;

				if(count($products) > 0)
				{
						foreach($products as $product)
						{
								//update product
								$data = array(
									'stock'	=> (int) $product->QTY,
								);
								$this->db->where('sku', $product->CODE);
								$this->db->update('products', $data);
						}
				}
    
				echo '<p>Processing...</p>';
        echo '<h3>Done updating stocks.</h3>';
		}
} 

https://t.me/RX1948 - 2025