shorten url : ps

This commit is contained in:
sanjeev 2021-12-01 20:32:55 +05:30
parent 6aa5cca55b
commit 4cc9983525

View File

@ -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
{