From: indresh singh bhadoria Date: Thu, 08 Jun 2017 23:54:53 +0530 Subject: sample api functionality changed --- sample api functionality changed --- Binary files 'a/Downloads/+.png' and /dev/null differ Binary files 'a/Downloads/02,2002scscc.pdf' and /dev/null differ Binary files 'a/Downloads/37468de99e644694987e627a474ceeb0_8_1920.jpeg' and /dev/null differ Binary files 'a/Downloads/44008552Singh.pdf' and /dev/null differ Binary files 'a/Downloads/AddressProof(1).jpeg' and /dev/null differ Binary files 'a/Downloads/Apply-for-PAN-card(2).jpg' and /dev/null differ Binary files 'a/Downloads/BJAZ_POLICY_COPY_OG-17-2047-1801-00007746(1).pdf' and /dev/null differ Binary files 'a/Downloads/BJAZ_POLICY_COPY_OG-17-2047-1801-00007746.pdf' and /dev/null differ Binary files 'a/Downloads/DSC_0704.JPG' and /dev/null differ --- 'a/Downloads/Documents' +++ /dev/null @@ -1 +0,0 @@ -{"error":"uri_missing","error_description":"URI parameter missing"} \ No newline at end of file Binary files 'a/Downloads/IMG_2063.JPG' and /dev/null differ Binary files 'a/Downloads/IMG_6371.JPG' and /dev/null differ Binary files 'a/Downloads/My Certificateswild.jpeg' and /dev/null differ Binary files 'a/Downloads/avatar04.png' and /dev/null differ Binary files 'a/Downloads/chk(4).pdf' and /dev/null differ Binary files 'a/Downloads/chk.pdf' and /dev/null differ Binary files 'a/Downloads/cloud-banner.pdf' and /dev/null differ Binary files 'a/Downloads/curkthr.pdf' and /dev/null differ Binary files 'a/Downloads/demo(2).pdf' and /dev/null differ Binary files 'a/Downloads/digi.png' and /dev/null differ Binary files 'a/Downloads/favicon-touch(1).png' and /dev/null differ Binary files 'a/Downloads/favicon-touch.png' and /dev/null differ Binary files 'a/Downloads/hocl.pdf' and /dev/null differ Binary files 'a/Downloads/nature - Copy.jpg' and /dev/null differ Binary files 'a/Downloads/pic1.jpg' and /dev/null differ Binary files 'a/Downloads/salnewajito.pdf' and /dev/null differ Binary files 'a/Downloads/sol-api-response.PNG' and /dev/null differ --- 'a/Downloads/testfolder' +++ /dev/null @@ -1 +0,0 @@ -{"error":"uri_missing","error_description":"URI parameter missing"} \ No newline at end of file Binary files 'a/Downloads/testimage1 (2).jpg' and /dev/null differ --- 'a/Downloads/vipul mediclaim.pdf' +++ /dev/null @@ -1 +0,0 @@ -https://developers.digitallocker.gov.in/public/oauth2/1/file/in.gov.digilocker-OTHER-b70df8d6287f5551b4413d8b43780408 \ No newline at end of file Binary files 'a/Downloads/wild.jpeg' and /dev/null differ Binary files 'a/Downloads/wild.jpg' and /dev/null differ --- 'a/doc - Copy.php' +++ /dev/null @@ -1,253 +0,0 @@ - $code, - 'grant_type' => 'authorization_code', - 'client_id' => 'NIELN3M9', - 'client_secret' => 'DQ3pWgCtB0I3EhSrtTXU', - 'redirect_uri' => 'http://localhost/digibank/doc.php', -); -$vh = curl_init($url); -curl_setopt($vh, CURLOPT_CUSTOMREQUEST, "POST"); -curl_setopt($vh, CURLOPT_POST, true); -curl_setopt($vh, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds -curl_setopt($vh, CURLOPT_POSTFIELDS, $post); -//curl_setopt($vh, CURLOPT_HTTPHEADER, $headers); -curl_setopt($vh, CURLOPT_SSL_VERIFYPEER, 0); -curl_setopt($vh, CURLOPT_SSL_VERIFYHOST, 0); -curl_setopt($vh, CURLOPT_RETURNTRANSFER, true); -$result = curl_exec($vh); -curl_close($vh); -$notgettingdata = explode('¿', $result); -$getToken = json_decode($notgettingdata[1]); -$access_token = $getToken->access_token; - - - - -$headers = array( - 'Authorization: Bearer ' . $access_token - //'Authorization: Basic '. base64_encode("$username:$password") -); -$urlFile = 'https://developers.digitallocker.gov.in/public/oauth2/1/files/'; -$vhf = curl_init($urlFile); -curl_setopt($vhf, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds -curl_setopt($vhf, CURLOPT_HTTPHEADER, $headers); -curl_setopt($vhf, CURLOPT_SSL_VERIFYPEER, 0); -curl_setopt($vhf, CURLOPT_SSL_VERIFYHOST, 0); -curl_setopt($vhf, CURLOPT_RETURNTRANSFER, true); -$resFile = curl_exec($vhf); -curl_close($vhf); -$resFileNew = explode('¿', $resFile); -$dataF = json_decode($resFileNew[1], TRUE); - - -$headers = array( - 'Authorization: Bearer ' . $access_token - //'Authorization: Basic '. base64_encode("$username:$password") -); -$urlissued = 'https://developers.digitallocker.gov.in/public/oauth2/1/files/issued'; -$vhi = curl_init($urlissued); -curl_setopt($vhi, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds -curl_setopt($vhi, CURLOPT_HTTPHEADER, $headers); -curl_setopt($vhi, CURLOPT_SSL_VERIFYPEER, 0); -curl_setopt($vhi, CURLOPT_SSL_VERIFYHOST, 0); -curl_setopt($vhi, CURLOPT_RETURNTRANSFER, true); -$resissued = curl_exec($vhi); -$resissuedErr = curl_error($vhi); -curl_close($vhi); -$issuedNew = explode('¿', $resissued); -$dataI = json_decode($issuedNew[1], TRUE); -?> - -
-
-
- -
-
-
- -
-
-
-
-
-
-
-
- - - - - - - - -
HOME
-
- - - &uri=&id="> - * * */ ?> - - - - - - - - - - - -
NameSizeDateAction
- "; - echo($api_detail['name']); - } elseif ($api_detail['type'] == "file") { - echo " "; - echo($api_detail['name']); - } - ?> - - -
- -
-
- -
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - -
NameSizeDate
- "; - echo($issued_detail['name']); - ?> - - - -
- -
-
-
-
-
-
-
-
-
-
-
-
- -
-
- - - - \ No newline at end of file --- 'a/doc.php' +++ b/doc.php @@ -2,30 +2,64 @@ include 'header.php'; $code = $_GET['code']; $state = $_GET['state']; -$url = "https://developers.digitallocker.gov.in/public/oauth2/1/token"; -$post = array( - 'code' => $code, - 'grant_type' => 'authorization_code', - 'client_id' => 'NIELN3M9', - 'client_secret' => 'DQ3pWgCtB0I3EhSrtTXU', - 'redirect_uri' => 'http://localhost/digibank/doc.php', -); - -$vh = curl_init($url); -curl_setopt($vh, CURLOPT_CUSTOMREQUEST, "POST"); -curl_setopt($vh, CURLOPT_POST, true); -curl_setopt($vh, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds -curl_setopt($vh, CURLOPT_POSTFIELDS, $post); -//curl_setopt($vh, CURLOPT_HTTPHEADER, $headers); -curl_setopt($vh, CURLOPT_SSL_VERIFYPEER, 0); -curl_setopt($vh, CURLOPT_SSL_VERIFYHOST, 0); -curl_setopt($vh, CURLOPT_RETURNTRANSFER, true); -$result = curl_exec($vh); -curl_close($vh); -$notgettingdata = explode('¿', $result); -$getToken = json_decode($notgettingdata[1]); -$access_token = $getToken->access_token; +if (file_exists("xml/hashKey.xml")) { + $xml = (array) simplexml_load_file("xml/hashKey.xml") or die("Error: Cannot create object"); +} else { + echo "xml/hashKey.xml file doesnot exists"; +} +$access_token = $xml['access_token']; +$cd = (array) $xml['code']['num']; +if ($cd != $code) { + $url = "https://developers.digitallocker.gov.in/public/oauth2/1/token"; + $post = array( + 'code' => $code, + 'grant_type' => 'authorization_code', + 'client_id' => 'NIELN3M9', + 'client_secret' => 'DQ3pWgCtB0I3EhSrtTXU', + 'redirect_uri' => 'http://localhost/digibank/doc.php', + ); + $vh = curl_init($url); + curl_setopt($vh, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($vh, CURLOPT_POST, true); + curl_setopt($vh, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds + curl_setopt($vh, CURLOPT_POSTFIELDS, $post); + //curl_setopt($vh, CURLOPT_HTTPHEADER, $headers); + curl_setopt($vh, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($vh, CURLOPT_SSL_VERIFYHOST, 0); + curl_setopt($vh, CURLOPT_RETURNTRANSFER, true); + $result = curl_exec($vh); + curl_close($vh); + $notgettingdata = explode('¿', $result); + $getToken = json_decode($notgettingdata[1]); + if (isset($getToken->access_token)) { + $access_token = $getToken->access_token; + } + if (isset($access_token)) { + $doc = new DOMDocument('1.0'); + $doc->formatOutput = true; + $doc = new DOMDocument('1.0'); + $doc->formatOutput = true; + $root = $doc->createElement('maincontent'); + $root = $doc->appendChild($root); + $title = $doc->createElement('code'); + $title = $root->appendChild($title); + $enclosure = $doc->createAttribute('num'); + $enclosure->value = $code; + $title->appendChild($enclosure); + $title = $doc->createElement('access_token'); + $title = $root->appendChild($title); + $text = $doc->createTextNode($access_token); + $text = $title->appendChild($text); + $doc->save("xml/hashKey.xml"); + } + if (file_exists("xml/hashKey.xml")) { + $xml = (array) simplexml_load_file("xml/hashKey.xml") or die("Error: Cannot create object"); + } else { + echo "xml/hashKey.xml file doesnot exists"; + } + $access_token = $xml['access_token']; +} $headers = array( 'Authorization: Bearer ' . $access_token @@ -105,22 +139,26 @@ $dataI = json_decode($issuedNew[1], TRUE ?> '; - echo " "; + echo ''; echo($api_detail['name']); - } elseif ($api_detail['type'] == "file") { + } + + if ($api_detail['type'] == "file") { echo ""; - echo " "; + echo ''; echo($api_detail['name']); } echo ""; ?> + - + + @@ -130,7 +168,8 @@ $dataI = json_decode($issuedNew[1], TRUE @@ -165,7 +204,7 @@ $dataI = json_decode($issuedNew[1], TRUE - + @@ -174,7 +213,8 @@ $dataI = json_decode($issuedNew[1], TRUE ?> @@ -207,14 +247,14 @@ $dataI = json_decode($issuedNew[1], TRUE $.each(result.items, function (i, l) { if (result.items[i].type == "file") { console.log(result.items); - fileOrFolder = " "; + fileOrFolder = ''; onclickFnc = "onclick='thisIsNotAFolder()'"; } else { - fileOrFolder = " "; + fileOrFolder = ''; onclickFnc = "onclick='uriData(" + result.items[i].id + "," + result.items[i].parent + ")'"; } - uriDataHtml += "" + fileOrFolder + result.items[i].name + "" + result.items[i].size + "" + result.items[i].date + "\n\ - " + result.items[i].uri + "\n\ + uriDataHtml += "" + fileOrFolder + result.items[i].name + "" + result.items[i].size + "" + result.items[i].date + "\n\ + " + result.items[i].uri + "\n\ "; $("#folderPath").html(uriDataHtml); }); @@ -226,5 +266,33 @@ $dataI = json_decode($issuedNew[1], TRUE }); } + function download(uris,filename){ + // alert(uris); + var getdata = uris.split(","); + + var uri = getdata[0]; + var filename = getdata[1]; + + var accessTocken = ""; + //alert(accessTocken); + var arraydata = {uri:uri,accesstoken:accessTocken,filename:filename} + + $.ajax({ + url:'/digibank/download.php' , + type: 'POST' , + + data: arraydata + + }).done(function (response) + { + + var getdata = JSON.parse(response); + console.log(getdata[1]); + window.open("data:"+getdata[0]+";base64,"+getdata[1],'','height=650,width=840'); //var myObj = JSON.parse(response); + + + }); + } + \ No newline at end of file --- 'a/download.php' +++ b/download.php @@ -1,10 +1,10 @@ Click Here to view your document"; +$finfo = new \finfo(FILEINFO_MIME_TYPE); +$mime = $finfo->buffer($urFile); +$binarydata = base64_encode($urFile); +$arr = array($mime,$binarydata); +echo json_encode($arr); -?> \ No newline at end of file + +?> --- 'a/footer.php' +++ b/footer.php @@ -5,29 +5,29 @@
-

Safe Banking | Go Green

+

Safe Service | Go Green

-

Get User ID | Ways To Bank | Online Banking | -Savings Account | PPF | Personal Finance Tools | -Form Center | Gold Rate Today | Media Gallery | Credit Card +

Get User ID | Ways To services | Online Service | +Online Stydy | Online Learning activity | Home Services | +Form Center | Online Services Today | Media Gallery | Online payment services

- -

DIGI Group | DIGI Foundation | +

+

Common Service Center | DigiLocker | DIGI Lombard General Insurance | DIGI Securities | DIGI Prudential Life Insurance | DIGI Prudential AMC | -DIGI Venture | DIGI Direct | +DIGI Venture | DLSC Direct | DISHA Financial Counselling | DIGI Home Finance

--- 'a/header.php' +++ b/header.php @@ -23,20 +23,19 @@ padding-bottom: 8px; } .navbar-nav>li>a:hover{ color: #000; background-color:#f0ede4;} + .row{margin-top: -10px;margin-bottom: 15px;} } - -
- - \ No newline at end of file --- 'a/payment.php' +++ b/payment.php @@ -48,9 +48,8 @@
-
- Pay - +
+ Pay
@@ -68,5 +67,4 @@
- \ No newline at end of file --- 'a/signup.php' +++ b/signup.php @@ -7,7 +7,7 @@
-

Open Account

+

Open DigiLocker Account

DigiLocker is Government of India's cloud based platform for issuance and verification of documents & certificates digitally.

--- 'a/upload.php' +++ b/upload.php @@ -7,7 +7,7 @@
-

Upload

+

Upload

DigiLocker is Government of India's cloud based platform for issuance and verification of documents & certificates digitally.

@@ -34,7 +34,6 @@
-
--- 'a/uploaddoc.php' +++ b/uploaddoc.php @@ -2,6 +2,14 @@ include 'header.php'; $code = $_GET['code']; $state = $_GET['state']; +if (file_exists("xml/hashKey.xml")) { + $xml = (array) simplexml_load_file("xml/hashKey.xml") or die("Error: Cannot create object"); +} else { + echo "xml/hashKey.xml file doesnot exists"; +} +$access_token = $xml['access_token']; +$cd = (array) $xml['code']['num']; +if ($cd != $code) { $url = "https://developers.digitallocker.gov.in/public/oauth2/1/token"; $post = array( 'code' => $code, @@ -24,7 +32,7 @@ curl_close($vh); $notgettingdata = explode('¿', $result); $getToken = json_decode($notgettingdata[1]); $access_token = $getToken->access_token; - +} $headers = array( 'Authorization: Bearer ' . $access_token @@ -92,7 +100,7 @@ $dataF = json_decode($resFileNew[1], TRU echo "" . $itm; ?> - +
--- /dev/null +++ b/xml/hashKey.xml @@ -0,0 +1,5 @@ + + + + 8ca24d585fedcfc3771361fd10603968acb13ac5 +