Update v1.0.6.6
This commit is contained in:
@@ -555,9 +555,10 @@ class ApiController extends Controller
|
||||
$result[$key]['picture'] = $path;
|
||||
}
|
||||
$result = $this->createPagination($result, 10);
|
||||
//dd($result);
|
||||
//$result->toJson();
|
||||
return $result->toJson();
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
114
app/Http/Controllers/Api/v1/ApiExceptAuthController.php
Normal file
114
app/Http/Controllers/Api/v1/ApiExceptAuthController.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\v1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
class ApiExceptAuthController extends Controller
|
||||
{
|
||||
public $api_controller;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->middleware('api');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the url is valid or not.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function checkUrl()
|
||||
{
|
||||
//dd($this->request);
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'url' => 'required|url',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
|
||||
$url = $this->request->input('url');
|
||||
$url = $url.'/api/v1/helpdesk/check-url';
|
||||
$result = $this->CallGetApi($url);
|
||||
// dd($result);
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $ex) {
|
||||
$error = $ex->getMessage();
|
||||
|
||||
return $error;
|
||||
} catch (\Symfony\Component\HttpKernel\Exception\HttpException $ex) {
|
||||
return ['status' => 'fails', 'code' => $ex->getStatusCode()];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Success for currect url.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function urlResult()
|
||||
{
|
||||
try {
|
||||
$result = ['status' => 'success'];
|
||||
|
||||
return $result;
|
||||
} catch (\Symfony\Component\HttpKernel\Exception\HttpException $ex) {
|
||||
return ['status' => 'fails', 'code' => $ex->getStatusCode()];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call curl function for Get Method.
|
||||
*
|
||||
* @param type $url
|
||||
*
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function callGetApi($url)
|
||||
{
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_HEADER, 0);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($curl);
|
||||
|
||||
if (curl_errno($curl)) {
|
||||
//echo 'error:' . curl_error($curl);
|
||||
}
|
||||
|
||||
return $response;
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call curl function for POST Method.
|
||||
*
|
||||
* @param type $url
|
||||
* @param type $data
|
||||
*
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function callPostApi($url, $data)
|
||||
{
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_HEADER, 0);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||
$response = curl_exec($curl);
|
||||
|
||||
if (curl_errno($curl)) {
|
||||
echo 'error:'.curl_error($curl);
|
||||
}
|
||||
|
||||
return $response;
|
||||
curl_close($curl);
|
||||
}
|
||||
}
|
@@ -473,6 +473,13 @@ class TestController extends Controller
|
||||
public function getCustomersWith()
|
||||
{
|
||||
try {
|
||||
//dd($this->server);
|
||||
$url = $this->server.'helpdesk/customers-custom?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
dd($respose);
|
||||
|
||||
return $respose;
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
|
Reference in New Issue
Block a user