From da795223c985fb3a98bcf4474fd4e747f1622269 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 14 Sep 2024 13:52:14 -0400 Subject: [PATCH] new blog location --- app/Controllers/BaseController.php | 46 ++++++++++++++++++++++++++++++ app/Controllers/Home.php | 12 ++++++-- app/Views/aboutus.php | 26 ++--------------- app/Views/blog_section.php | 37 ++++++++++++++++++++++++ app/Views/merms-home.php | 38 ++---------------------- docker-compose.yml | 3 ++ 6 files changed, 102 insertions(+), 60 deletions(-) create mode 100644 app/Views/blog_section.php diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 63cbc21..01715ec 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -97,4 +97,50 @@ class BaseController extends Controller { return $blog_post; } + 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 f188205..345379a 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -9,12 +9,18 @@ class Home extends BaseController { public function index() { // $wpData = WpContentsClient::serviceGetBlogItems(); + $out = $this->APIcall('GET','https://blogdata.chiefsoft.net/blogdata/mermsemr',[]); // https://blogdata.chiefsoft.net/ + $data["blog_post"] = $out['payload']['blogdata']; +// var_dump( $data["blog_post"] ); +//exit(); global $myfit_items; global $practice_text1; global $practice_text2; $data = array(); - $data["blog_post"] =$this->getBlogItems(); // $blog_post; + // $data["blog_post"] =$this->getBlogItems(); // $blog_post; + $data["blog_post"] = $out['payload']['blogdata']; + $data["myfit_items"] = $myfit_items; $data["practice_text1"] = $practice_text1; $data["practice_text2"] = $practice_text2; @@ -29,7 +35,9 @@ class Home extends BaseController { global $practice_text1; global $practice_text2; $data = array(); - $data["blog_post"] =$this->getBlogItems(); // $blog_post; + $out = $this->APIcall('GET','https://blogdata.chiefsoft.net/blogdata/mermsemr',[]); // https://blogdata.chiefsoft.net/ + $data["blog_post"] = $out['payload']['blogdata']; + // $data["blog_post"] =$this->getBlogItems(); // $blog_post; $data["myfit_items"] = $myfit_items; $data["practice_text1"] = $practice_text1; $data["practice_text2"] = $practice_text2; diff --git a/app/Views/aboutus.php b/app/Views/aboutus.php index aeeb1b9..7a2d2a1 100644 --- a/app/Views/aboutus.php +++ b/app/Views/aboutus.php @@ -71,29 +71,9 @@
-
- -
+
diff --git a/app/Views/blog_section.php b/app/Views/blog_section.php new file mode 100644 index 0000000..66e3447 --- /dev/null +++ b/app/Views/blog_section.php @@ -0,0 +1,37 @@ +
+ +
\ No newline at end of file diff --git a/app/Views/merms-home.php b/app/Views/merms-home.php index 32a9a87..d377431 100644 --- a/app/Views/merms-home.php +++ b/app/Views/merms-home.php @@ -262,43 +262,11 @@
-
- -
diff --git a/docker-compose.yml b/docker-compose.yml index ab3bf03..9795712 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,5 +18,8 @@ services: - ./apache_log:/var/log/apache2 ports: - 8088:80 + extra_hosts: + - blogdata.chiefsoft.net:10.10.33.15 + - sitedata.chiefsoft.net:10.10.33.15 volumes: src: \ No newline at end of file