diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index e9452025..763bb0fa 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -11314,6 +11314,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $url = $this->get('url'); $this->load->helper('video_grabber_helper'); $concat_url = "127.0.0.1:5000/sh_url?url=".$url; + // 1 $client = new \GuzzleHttp\Client(); $res = $client->get($concat_url,['headers'=>['Content-Type' => 'application/json']]); if($res && $res->getStatusCode() == 200) @@ -11322,12 +11323,38 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() }else{ $result_data = array(); } -// print_r($result_data);die(); - if(!empty($result_data) && $result_data['datastatus'] == 200) + // print_r($result_data);die(); + // 2 + // $ch = curl_init(); + // $timeout = 5; + // $headers = array('Content-type: application/json'); + // curl_setopt( $ch,CURLOPT_URL, $concat_url ); + // curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers ); + // curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true ); + // curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); + // $result = curl_exec($ch ); + // curl_close( $ch ); + // print_r($result); + // $client = new GuzzleHttp\Client(); + // $res = $client->request('GET',$concat_url); + // echo $res->getStatusCode(); + // // "200" + // echo $res->getHeader('content-type')[0]; + // // 'application/json; charset=utf8' + // echo $res->getBody(); + // {"type":"User"...' + // Send an asynchronous request. + // $request = new \GuzzleHttp\Psr7\Request('GET',$concat_url); + // $promise = $client->sendAsync($request)->then(function ($response) { + // echo 'I completed! ' . $response->getBody(); + // }); + // $promise->wait(); + + if(!empty($result_data) && $result_data->datastatus == 200) { $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['shorten_url'] = $result_data['data']; + $data['shorten_url'] = $result_data->data; } else {