From e5fd1870559a9c18628e3a1dc84687c8839a0d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Csuganyaudhay=E2=80=9D?= Date: Fri, 7 Jun 2019 15:51:15 +0530 Subject: [PATCH 1/2] I have fixed the bug to return whole response object instead of just the data key of the response --- src/PhpCricket/PhpCriclib.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/PhpCricket/PhpCriclib.php diff --git a/src/PhpCricket/PhpCriclib.php b/src/PhpCricket/PhpCriclib.php old mode 100644 new mode 100755 index c87f367..48131eb --- a/src/PhpCricket/PhpCriclib.php +++ b/src/PhpCricket/PhpCriclib.php @@ -114,7 +114,7 @@ function __construct($accessKey, $secretKey, $appId, $deviceId) { * @param $fields Pass the parameters for appending to API. * */ - function getData($req_url, $fields){ + function getData($req_url, $fields,$res_status = false){ $url = RCA_url. $req_url. '/?access_token=' . $this->access_token . '&' . http_build_query($fields); $ch = curl_init(); @@ -125,7 +125,11 @@ function getData($req_url, $fields){ $response = curl_exec($ch); $response = json_decode($response, true); curl_close($ch); - return $response['data']; + if($res_status == true){ + return $response; + }else{ + return $response['data']; + } } From a04df9df347d79806074a59dd17078cd98b15f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Csuganyaudhay=E2=80=9D?= Date: Fri, 7 Jun 2019 18:05:31 +0530 Subject: [PATCH 2/2] Added error controller to disable error occurs while creating accesstoken file --- src/PhpCricket/PhpCriclib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpCricket/PhpCriclib.php b/src/PhpCricket/PhpCriclib.php index 48131eb..971018d 100755 --- a/src/PhpCricket/PhpCriclib.php +++ b/src/PhpCricket/PhpCriclib.php @@ -46,7 +46,7 @@ function getValidToken(){ } $fields_string=rtrim($fields_string, '&'); - $infotxt = file_get_contents('accesstoken.txt'); + $infotxt = @file_get_contents('accesstoken.txt'); $info = json_decode($infotxt, TRUE); /**