From: indresh singh bhadoria Date: Tue, 18 Jul 2017 15:55:52 +0530 Subject: json issue response handle --- json issue response handle --- --- 'a/browse.php' +++ b/browse.php @@ -23,8 +23,8 @@ curl_setopt($ch, CURLOPT_TCP_NODELAY, 1) curl_setopt($ch, CURLOPT_HTTPHEADER, $ur); $output = curl_exec($ch); curl_close($ch); -$outputData = explode('¿', $output); -$data = (array) json_decode($outputData[1]); +//$outputData = explode('¿', $output); +$data = (array) json_decode($output); if (isset($data['size'])) { $message = "File Uploaded Successfully"; } else { --- 'a/doc.php' +++ b/doc.php @@ -24,11 +24,11 @@ curl_setopt($vh, CURLOPT_SSL_VERIFYHOST, curl_setopt($vh, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($vh); curl_close($vh); -$notgettingdata = explode('¿', $result); -if(!$notgettingdata[1]){ -header("Location: index.php?message=THIS IS ERROR"); -} -$getToken = json_decode($notgettingdata[1]); +//$notgettingdata = explode('¿', $result); +//if(!$notgettingdata[1]){ +//header("Location: index.php?message=THIS IS ERROR"); +//} +$getToken = json_decode($result); if (isset($getToken->access_token)) { $access_token = $getToken->access_token; } @@ -71,12 +71,12 @@ curl_setopt($vhf, CURLOPT_SSL_VERIFYHOST curl_setopt($vhf, CURLOPT_RETURNTRANSFER, true); $resFile = curl_exec($vhf); curl_close($vhf); -$resFileNew = explode('¿', $resFile); -$uriRes = json_decode($resFileNew[1]); -if(isset($uriRes->error) || !$resFileNew){ - header("Location: index.php?message=".$uriRes->error_description); - exit; -} +//$resFileNew = explode('¿', $resFile); +$uriRes = json_decode($resFile); +//if(isset($uriRes->error) || !$resFileNew){ +// header("Location: index.php?message=".$uriRes->error_description); +// exit; +//} $uriDir = array(); $uriFiles = array(); foreach ($uriRes->items as $uriI) { @@ -91,7 +91,6 @@ $uriItems = array_merge($uriDir, $uriFil $uriItemsArray[$item] = $uriItems; $dataDirectory['directory'] = $uriRes->directory; $dataF = array_merge($dataDirectory, $uriItemsArray); - $headers = array( 'Authorization: Bearer ' . $access_token //'Authorization: Basic '. base64_encode("$username:$password") @@ -106,8 +105,8 @@ curl_setopt($vhi, CURLOPT_RETURNTRANSFER $resissued = curl_exec($vhi); $resissuedErr = curl_error($vhi); curl_close($vhi); -$issuedNew = explode('¿', $resissued); -$dataI = json_decode($issuedNew[1], TRUE); +//$issuedNew = explode('¿', $resissued); +$dataI = json_decode($resissued, TRUE); include 'header.php'; ?> --- 'a/uploaddoc.php' +++ b/uploaddoc.php @@ -24,11 +24,11 @@ curl_setopt($vh, CURLOPT_SSL_VERIFYHOST, curl_setopt($vh, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($vh); curl_close($vh); -$notgettingdata = explode('¿', $result); -if(!$notgettingdata[1]){ -header("Location: index.php?message=THIS IS ERROR"); -} -$getToken = json_decode($notgettingdata[1]); +//$notgettingdata = explode('¿', $result); +//if(!$notgettingdata[1]){ +//header("Location: index.php?message=THIS IS ERROR"); +//} +$getToken = json_decode($result); if (isset($getToken->access_token)) { $access_token = $getToken->access_token; } @@ -71,12 +71,12 @@ curl_setopt($vhf, CURLOPT_SSL_VERIFYHOST curl_setopt($vhf, CURLOPT_RETURNTRANSFER, true); $resFile = curl_exec($vhf); curl_close($vhf); -$resFileNew = explode('¿', $resFile); -$uriRes = json_decode($resFileNew[1]); -if(isset($uriRes->error) || !$resFileNew){ - header("Location: index.php?message=".$uriRes->error_description); - exit; -} +//$resFileNew = explode('¿', $resFile); +$uriRes = json_decode($resFile); +//if(isset($uriRes->error) || !$resFileNew){ +// header("Location: index.php?message=".$uriRes->error_description); +// exit; +//} $uriDir = array(); $uriFiles = array(); foreach ($uriRes->items as $uriI) { --- 'a/uri.php' +++ b/uri.php @@ -17,8 +17,8 @@ curl_setopt($uri, CURLOPT_SSL_VERIFYHOST curl_setopt($uri, CURLOPT_RETURNTRANSFER, true); $uriResissued = curl_exec($uri); curl_close($uri); -$resFileNew = explode('¿', $uriResissued); -$uriRes = json_decode($resFileNew[1]); +//$resFileNew = explode('¿', $uriResissued); +$uriRes = json_decode($uriResissued); $uriDir = array(); $uriFiles = array(); foreach ($uriRes->items as $uriI) {