From: indresh singh bhadoria Date: Wed, 19 Jul 2017 18:48:33 +0530 Subject: error handling --- error handling --- --- 'a/browse.php' +++ b/browse.php @@ -23,7 +23,6 @@ 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($output); if (isset($data['size'])) { $message = "File Uploaded Successfully"; --- 'a/doc.php' +++ b/doc.php @@ -24,10 +24,6 @@ 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($result); if (isset($getToken->access_token)) { $access_token = $getToken->access_token; @@ -71,12 +67,11 @@ 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($resFile); -//if(isset($uriRes->error) || !$resFileNew){ -// header("Location: index.php?message=".$uriRes->error_description); -// exit; -//} +if(isset($uriRes->error) || !$resFile){ + header("Location: index.php?message=".$uriRes->error_description); + exit; +} $uriDir = array(); $uriFiles = array(); foreach ($uriRes->items as $uriI) { @@ -105,7 +100,6 @@ curl_setopt($vhi, CURLOPT_RETURNTRANSFER $resissued = curl_exec($vhi); $resissuedErr = curl_error($vhi); curl_close($vhi); -//$issuedNew = explode('¿', $resissued); $dataI = json_decode($resissued, TRUE); include 'header.php'; --- 'a/uploaddoc.php' +++ b/uploaddoc.php @@ -24,10 +24,6 @@ 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($result); if (isset($getToken->access_token)) { $access_token = $getToken->access_token; @@ -71,12 +67,11 @@ 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($resFile); -//if(isset($uriRes->error) || !$resFileNew){ -// header("Location: index.php?message=".$uriRes->error_description); -// exit; -//} +if(isset($uriRes->error) || !$resFile){ + header("Location: index.php?message=".$uriRes->error_description); + exit; +} $uriDir = array(); $uriFiles = array(); foreach ($uriRes->items as $uriI) { --- 'a/uri.php' +++ b/uri.php @@ -1,5 +1,4 @@