我想在PHP中集成Aadhaar卡认证。我可以尝试这个代码,但没有得到响应。如何使用此代码获得响应其他明智的地方我错了吗?我可以找到Aadhaar卡API的更多细节,但没有得到回应。
<?php
$URL = "http://auth.uidai.gov.in/1.6/public/9/9/MH4hSkrev2h_Feu0lBRC8NI-iqzT299_qPSSstOFbNFTwWrie29ThDo";
$xml_data = '<?xml version="1.0"?>
<Auth xmlns="http://www.uidai.gov.in/authentication/uid-auth-request/1.0"
ver="1.5" tid="public" ac="public" sa="public"
lk="MKg8njN6O+QRUmYF+TrbBUCqlrCnbN/Ns6hYbnnaOk99e5UGNhhE/xQ=" uid="999999990019"
txn="GEO.11051880">
<Skey ci="20131003">Nc6DrZKFk1oQXxfgnFUl0mmtYYIPl0RGaFd2oINkpChU1++xdddMx6Dlbz6mEYs3
IyzChGjRXN5/al9r0runFX8LspTfMchwpxaaDIOyIUguBoYmPUqJDqTQcwey6Ntc
TJWFSgOvBg+omUkdbK/9GOQ5KWWrN+E0A9JN0IPU4IJqJZmsA6ETZlVoZteYtoMI
Ucv53qmxNPOEmJ3s4BC3ppHRRWRFMUp/eW7DFJ33W+uInZB6yekKE0dz8fYeo03w
2JUT1wlafL7aseb04nv5tNEbllHWafmbMpbv2pXKr+WPgytjrygt1LagGqF4a5Mr
/UTNwsy4m/YwlkWN0QcYVw==
</Skey>
<Uses otp="n" pin="n" bio="n" pa="n" pfa="n" pi="y" />
<Data>YOn05vg5qMwElULpEmdiH0j6rM1XWcbQN0n+CFNQeazouCgjyPBH/a2SwbFgq/fF
CYUm+the8gQyYC36VO49NLcNcD7WdMhweoiDYgJoCX/t87Kbq/ABoAetfX7OLAck
/mHrTmw8tsfJgo4xGSzKZKr+pVn1O8dDHJjwgptySr7vp2Ntj6ogu6B905rsyTWw
73iMgoILDHf5soM3Pvde+/XW5rJD9AIPQGhHnKirwkiAgNIhtWU6ttYg4t6gHHbZ
0gVBwgjRzM3sDWKzK0EnmA==
</Data>
<Hmac>xy+JPoVN9dsWVm4YPZFwhVBKcUzzCTVvAxikT6BT5EcPgzX2JkLFDls+kLoNMpWe
</Hmac>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<Reference>
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>Idd9hQtO+YAR4bjfQpNxXQ/EvXc=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>SyFAqzqtJ/VTWcR5cdxoIcsa7GMmgJo7X2Rtr+CVYZLaL2myg3HgaasaT7tPOa95
xYJwnwA/pl+S7ki+W/4Kq1nraV/wxArgE5hFTUFG8G/MOcuMy9Ajd1VPvuqMGvHA
gzGfV+qTcU+1lhQscYnwJqqFmoViZO7NRVwPcfgadXs=</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>MIICfzCCAeigAwIBAgIGAbAh09VkMA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNVBAYT
AklOMQswCQYDVQQIEwJLQTESMBAGA1UEBxMJQmFuZ2Fsb3JlMQ4wDAYDVQQKEwVV
SURBSTEeMBwGA1UECxMVQXV0aGVudGljYXRpb24gU2VydmVyMRowGAYDVQQDExFV
SURBSSBBdXRoIFNlcnZlcjAeFw0xMTA2MjgwNDQwNDRaFw0xMjA2MjgwNDQwNDRa
MGkxCzAJBgNVBAYTAklOMQswCQYDVQQIEwJLQTESMBAGA1UEBxMJQmFuZ2Fsb3Jl
MRMwEQYDVQQKEwpQdWJsaWMgQVVBMQ8wDQYDVQQLEwZQdWJsaWMxEzARBgNVBAMT
ClB1YmxpYyBBVUEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJBEgKhZZNmH
ejKTFaSg0Z/KN6kP98/FKpPkGTlkovJxa7KX0x74I++JhObM8SkRgCGR3DBK/YZB
o0ZCbvs9czTEoDA8CBMDSFLEP5z+Zi65hdNT9XQiaeN0sSY7N4cafsS/KH/LESbM
6I5OLvSGj10aQB8KDgwItvp/7xK6/Vu3AgMBAAGjITAfMB0GA1UdDgQWBBSd3qZJ
j5lPp+1zkJJCqyZoTLLWAzANBgkqhkiG9w0BAQUFAAOBgQBiGVbCITrygzpC+09u
R/l8w0hCInLusQMZeXgHcnxBGDSk1AQxKk5UfQmCwHNcRJMB5Zkj8+9n6T+/wx6D
tKDelktgIoo7w0EJ6MdVJ9Qzr5PJcYzX+ERgJEd/NNNVoPjFc2Al2odjToZdFN8+
/upJnBH02TRb1Wq63OtcuyBIFA==</X509Certificate>
<X509SubjectName>CN=Public AUA,OU=Public,O=Public
AUA,L=Bangalore,ST=KA,C=IN</X509SubjectName>
</X509Data>
</KeyInfo>
</Signature>
</Auth>';
//setting the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);
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);
}
?>
2条答案
按热度按时间ee7vknir1#
在上面的代码中,您将请求发送到版本1.6,而在XML数据中,您提到了版本1.5,您正在发送的XML数据中缺少一些参数,这些缺少的数据是强制性的。请求部分缺少一些关键字。
我已经按照Uidai指南解决了这个问题。但还没有得到成功的响应,因为你没有提供的一些关键和一些关键,你提供的是无效的。
tquggr8v2#
得到这个响应