diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 8b435da..68ed24b 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -55,4 +55,50 @@ abstract class BaseController extends Controller // E.g.: $this->session = \Config\Services::session(); } + public function APIcall($method, $url, $data) { + // $curl = curl_init(); + $curl = curl_init($url); + switch ($method) { + case "GET": + $params2 = ''; + foreach($data as $key2=>$value2) + $params2 .= $key2.'='.$value2.'&'; + + $params2 = trim($params2, '&'); + $url = $url.'?'.$params2;// add param to URL + log_message('critical', "API URL FINAL =>".$url ); + //curl_setopt($curl, CURLOPT_FRESH_CONNECT, true); + //curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + //curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); + break; + case "POST": + curl_setopt($curl, CURLOPT_POST, 1); + if ($data) + // curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); + // curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); + break; + case "PUT": + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); + if ($data) + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + break; + } + + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_HTTPHEADER, array( + 'APIKEY: RegisteredAPIkey', + 'Content-Type: application/json', + )); + + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); + $result = curl_exec($curl); + + if(!$result) { + echo("Connection failure!"); + } + curl_close($curl); + return json_decode($result, true); + } } diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 5934333..eb8ea11 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -6,6 +6,15 @@ class Home extends BaseController { public function index(): string { - return view('welcome_message'); + $siteData =[]; + //http://10.204.5.100:9083/en/wrench/api/v1/blogdata + $out = $this->APIcall('GET','http://10.204.5.100:9083/en/wrench/api/v1/blogdata',[]); + // var_dump($out['blogdata']); + //exit(); + $siteData['blogdata'] = $out['blogdata']; + //var_dump($siteData); + // exit; + + return view('welcome_message',$siteData); } } diff --git a/app/Views/welcome_message.php b/app/Views/welcome_message.php index ec0e6a1..7785f77 100644 --- a/app/Views/welcome_message.php +++ b/app/Views/welcome_message.php @@ -1271,218 +1271,238 @@
--- Bring your ideas to life an intuitive Enterprise Architect. Full Stack Engineer, and Security Lover & customize your site and see the changes instantly. -
-
- =$item['post_title']?>
--- Incredible theme and fantastic support! Every time I had a question, they got back to you so quickly and fixed your problem! Im so impressed! Thank you guys again for your precious help! Your customer support is amazing! -
-
- --- I'm early on in the process of building my website; however, I'm already impressed by customer support's response time. Great customer support ratings is something I consider before purchasing a theme. -
-
- Thank you LiquidThemes! -
- --- Simply perfect! Theme and support are amazing! Frank thanks for the help, always fast and efficient! The best theme and support I've had! -
-
- --- Bring your ideas to life an intuitive Enterprise Architect. Full Stack Engineer, and Security Lover. Customize your site and see the changes instantly. -
-
- --- Incredible theme and fantastic support! Every time I had a question, they got back to you so quickly and fixed your problem! Im so impressed! Thank you guys again for your precious help! Your customer support is amazing! -
-
- --- I' m early on in the process of building my website; however, I'm already impressed by customer support's response time. Great customer support ratings is something I consider before purchasing a theme. -
-
- Thank you LiquidThemes! -
- --- Simply perfect! Theme and support are amazing! Frank thanks for the help, always fast and efficient! The best theme and support I've had! -
-
- Trusted by global brands. Join Millions of customers around the globe.
+Trusted by Product & Software Engineers. Join Millions of customers around the globe.