2017-03-07 154 views
0

如何從用戶手機號碼和aadhaar號碼中獲取用戶信息?從aadhaar號獲取用戶信息

作爲用戶手機號碼和號碼輸入 輸出爲用戶詳細信息,如用戶名(名字和姓氏),手機號碼和個人資料圖像。

一般我們做了用戶社交登錄我們給電子郵件ID和獲取的細節,在這裏我們需要給aadhaar數量和獲取信息

是任何API或如何從aadhaar號碼和移動用戶的詳細信息號碼?

我用下面的代碼,但不是爲我工作

<?php 
$adhar_card_no = ""; 

function buildUrl($adhar_card_no) 
{ 
    $host = "http://auth.uidai.gov.in"; 
    $version = 1.6; 
    $aua = ""; 
    $asalk = ""; 
    $uid = str_split($adhar_card_no); 
    $url = $host."/".$version."/".$aua."/".$uid[0]."/".$uid[1]."/".$asalk; 
    return $url; 
} 

function requestDataBuilder($uid) 
{ 
    $encrypted_encoded_session_key = ""; 
    $encrypted_pid_block = ""; 
    $sha256_pid_bloc_encrypted_encoded= ""; 
    $digital_aua_signatrure= ""; 
    /** 
    * Authentication data to send request --Mandatory 
    */ 
    $auth_data = [ 
     "uid" => $uid, //Adhaar Card No. 
     "tid" => "", //Terminal Id for registered device else public 
     "ac" => "", //10 char unique code, public for testing 
     "sa" => "", //max length 10, same as ac possible 
     "ver" => 1.6, //Current version 
     "txn" => "", //AUA transaction identifier. max length 50, not U* 
     "lk" => "", //Valid License Key, max length 64 
    ]; 
    /** 
    * Uses data comprises of options as yes (y) or no (n) -- Mandatory 
    */ 
    $uses_data = [ 
     "pi" => "n", 
     "pa" => "n", 
     "pfa" => "n", 
     "bio" => "n", 
     "bt" => "n", 
     "pin" => "n", 
     "otp" => "n" 
    ]; 
    /** 
    * Token data -- optional 
    */ 
    $tkn_data = [ 
     "type" => "001", //only this option available for now which is mobile no. 
     "value" => "" //Mobile no. 10 digit only no prefix 
    ]; 
    /** 
    * Meta Data Mandatory 
    */ 
    $meta_data = [ 
     "udc" => $udc, //[vendorcode][date of deployment][serial number] max length 20 
     "fdc" => "NA", //Fingerprint device code. use NA or NC or given code 
     "idc" => "NA", //Iris device code, us na or NC 
     "pip" => "NA", //Public IP address of the device, or NA 
     "lot" => "P", //G -lat long format. p for pincode format 
     "lov" => "110025" // value as per G and P- my pin change it 
    ]; 
    /** 
    * Skey data -- Mandatory 
    */ 
    $skey_data = [ 
     "ci" => "", //Public key certificate Identifier --mandatory 
     "ki" => "" //This is for advanced use only, --optional 
    ]; 

    $format = '<Auth uid="'.$auth_data['uid'].'" tid ="'.$auth_data['tid'].'" ac="'.$auth_data['ac'].'" sa="'.$auth_data['sa'].'" ver="'.$auth_data['ver'].'" txn="'.$auth_data['txn'].'" lk="'.$auth_data['lk'].'">'; 
    $format.= '<Uses pi="'.$uses_data['pi'].'" pa="'.$uses_data['pa'].'" pfa="'.$uses_data['pfa'].'" bio="'.$uses_data['bio'].'" bt="'.$uses_data['bt'].'" pin="'.$uses_data['pin'].'" otp="'.$uses_data['otp'].'"/>'; 
    $format.= '<Tkn type="'.$tkn_data['type'].'" value="'.$tkn_data['value'].'"/>'; 
    $format.= '<Meta udc="'.$meta_data['udc'].'" fdc="'.$meta_data['fdc'].'" idc="'.$meta_data['idc'].'" pip="'.$meta_data['pip'].'" lot="'.$meta_data['lot'].'" lov="'.$meta_data['lov'].'"/>'; 
    $format.= '<Skey ci="'.$skey_data['ci'].'" ki="'.$skey_data['ci'].'">'.$encrypted_encoded_session_key.'</Skey>'; 
    $format.= '<Data type="X">'.$encrypted_pid_block.'</Data>'; 
    $format.= '<Hmac>'.$sha256_pid_bloc_encrypted_encoded.'</Hmac>'; 
    $format.= '<Signature>'.$digital_aua_signatrure.'</Signature></Auth>'; 
    return $format;  

} 
$request_url = buildUrl($adhar_card_no); echo "<br>"; 
$data_to_send = requestDataBuilder($adhar_card_no); 

//setting the curl parameters. 
$ch = curl_init(); 
$curl_options = [ 
    CURLOPT_URL => $request_url, 
    CURLOPT_VERBOSE => 1, 
    CURLOPT_SSL_VERIFYHOST => 0, 
    CURLOPT_SSL_VERIFYPEER => 0, 
    CURLOPT_POST => 1, 
    CURLOPT_RETURNTRANSFER => 1, 
    CURLOPT_HTTPHEADER => array('Content-Type: application/xnl'), 
    CURLOPT_POSTFIELDS => $data_to_send 
]; 
curl_setopt_array($ch, $curl_options); 
if (curl_errno($ch)) { 
// moving to display page to display curl errors 
    echo curl_errno($ch) ; 
    echo curl_error($ch); 
} else { 
    //getting response from server 
    $response = curl_exec($ch); 
    print_r($response); 
    curl_close($ch); 
} 
?> 

敬請發佈您的代碼

回答

1

你不能得到aadhaar細節,如你在呼喚。您必須致電其需要數字簽名請求的Web服務。首先,你應該有數字證書籤名請求,你必須簽署協議,以便使用他們的服務。

您可以查看以下鏈接作爲您的查詢參考:https://groups.google.com/forum/#!forum/aadhaarauth