Subversion Repositories SmartDukaan

Rev

Rev 10582 | Rev 10756 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10582 Rev 10739
Line 23... Line 23...
23
 
23
 
24
	function __construct()
24
	function __construct()
25
	{
25
	{
26
		$this->_ci = & get_instance();
26
		$this->_ci = & get_instance();
27
		log_message('debug', 'Mcurl Class Initialized');
27
		log_message('debug', 'Mcurl Class Initialized');
28
 
-
 
29
		if (!$this->is_enabled())
28
		if (!$this->is_enabled())
30
		{
29
		{
31
			log_message('error', 'Mcurl Class - PHP was not built with cURL enabled. Rebuild PHP with --with-curl to use cURL.');
30
			log_message('error', 'Mcurl Class - PHP was not built with cURL enabled. Rebuild PHP with --with-curl to use cURL.');
32
		}
31
		}
33
		else 
32
		else 
Line 127... Line 126...
127
 
126
 
128
			// after all requests finish, set errors and repsonses in $this->calls
127
			// after all requests finish, set errors and repsonses in $this->calls
129
			foreach ($this->calls as $key => $call)
128
			foreach ($this->calls as $key => $call)
130
			{
129
			{
131
				$error = curl_error($this->calls[$key]["curl"]);
130
				$error = curl_error($this->calls[$key]["curl"]);
-
 
131
				//print_r($key);
-
 
132
				//print_r($error);
132
				if (!empty($error))
133
				if (!empty($error))
133
				{
134
				{
-
 
135
					if($key != 'recommended_accessories'){
134
					$this->calls[$key]["error"] = $error;
136
					$this->calls[$key]["error"] = $error;
-
 
137
					$errmsg ='<h3>OH SNAP!!!! :</h3><p>Something is not right. <br/><h1>But Relax</h1> <br/>We are working hard on it. </p>';
-
 
138
					//$this->write_log_send_mail('error',$msg);
-
 
139
					//$this->session->set_flashdata('errormsg',$errmsg);
-
 
140
					redirect(base_url().'error_page/index',$data);
-
 
141
					exit();
-
 
142
					}
135
				}
143
				}
136
				$this->calls[$key]["response"] = curl_multi_getcontent($this->calls[$key]["curl"]);
144
				$this->calls[$key]["response"] = curl_multi_getcontent($this->calls[$key]["curl"]);
-
 
145
				if($key != 'recommended_accessories'){
-
 
146
				if(isset($this->calls[$key]["response"]) && !empty($this->calls[$key]["response"])){
137
				curl_multi_remove_handle($this->curl_parent,$this->calls[$key]["curl"]);
147
					curl_multi_remove_handle($this->curl_parent,$this->calls[$key]["curl"]);	
-
 
148
				}else{
-
 
149
					$this->calls[$key]["error"] = $error;
-
 
150
					$errmsg ='<h3>OH SNAP!!!! :</h3><p>Something is not right. <br/><h1>But Relax</h1> <br/>We are working hard on it. </p>';
-
 
151
					redirect(base_url().'error_page/index',$data);
-
 
152
					exit();
-
 
153
				}
-
 
154
				}
138
			}
155
			}
139
 
156
 
140
			curl_multi_close($this->curl_parent);
157
			curl_multi_close($this->curl_parent);
141
		}
158
		}
142
 
159