function execute( $url_segment, $data, $excute_type, $is_info_log = false ) {
		$curl = curl_init();

		curl_setopt($curl, CURLOPT_URL, .$url_segment);
                // $excute_type = 'POST' or 'GET' 
		curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $excute_type);
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($curl, CURLOPT_NOSIGNAL, 1);
		// curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
		curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
		curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 3);
		//curl_setopt($curl, CURLOPT_TIMEOUT, CUR_TIMEOUT);

		/*curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($curl, CURLOPT_SSLVERSION,3);
		curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
		*/

		$result = curl_exec($curl);
		curl_close( $curl );
		log_message('error', 'url:'.$url_segment.', data:'. json_encode($data).' result1:'.$result );

		$obj = json_decode( $result, true );
		$log_level = 'error';
		if( $is_info_log ) {
			$log_level = 'info';
		}
		log_message($log_level, 'url:'.$url_segment.', data:'. json_encode($data).' result:'.$result );
		return $obj;
	}

+ Recent posts