From 2e3c14c306fb933dc8066c9dc1f0d6b62df8ebd1 Mon Sep 17 00:00:00 2001 From: sanjeev Date: Wed, 1 Dec 2021 18:28:20 +0530 Subject: [PATCH] shorten url :ps --- api/application/controllers/PD_Controller.php | 42 ++++--------------- 1 file changed, 7 insertions(+), 35 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index df8067c5..e1b67789 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -11313,42 +11313,14 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() function getShortenURL_get(){ $url = $this->get('url'); $this->load->helper('video_grabber_helper'); - // $url="https://venbainfotech.com/VenbaIT/"; - // $result_data = "127.0.0.1:5000/sh_url?url=".$url; - // $result_data = exec($result_data); - // $result_data = json_decode($result_data,true); + $concat_url = "127.0.0.1:5000/sh_url?url=".$url; $client = new \GuzzleHttp\Client(); - // $response = $client->request('GET',$result_data); - // print_r($response);die(); - // $ch = curl_init(); - // $timeout = 5; - // curl_setopt($ch,CURLOPT_URL,$result_data); - // curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); - // curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); - // $tinyurl = curl_exec($ch); - // print_r($tinyurl);die(); - $client = new \GuzzleHttp\Client(); - $res = $client->get( 'http://github.com', [ - 'headers' => ['Content-Type' => 'application/json'], - ]); - print_r($res); - print_r(json_decode($res->getBody())); - // print_r($res); - // try{ - // $response = $client->request('GET', 'http://github.com'); - // print_r($response);die(); - // } - // catch (ConnectException $e) { - // // Connection exceptions are not caught by RequestException - // echo "Internet, DNS, or other connection error\n"; - // die; - // } - // catch (RequestException $e) { - // echo "Request Exception\n"; - // die; - // } - - die(); + $res = $client->get($concat_url,['headers'=>['Content-Type' => 'application/json']]); + if($res && $res->getStatusCode() == 200) + { + $result_data = json_decode($response->getBody()->getContents()); + } +print_r($result_data);die(); if(!empty($result_data) && $result_data['datastatus'] == 200) { $data['dataStatus'] = true;