php 从 IBAN 银行帐号生成 BIC
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13135361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Generate BIC from IBAN bank account number
提问by Tim
Is there any existing library or script I can use to generate the BIC code from an IBAN bank account number (and other necessary information)?
是否有任何现有的库或脚本可用于从 IBAN 银行帐号(和其他必要信息)生成 BIC 代码?
I've searched the web, but found only IBAN generators.
我在网上搜索过,但只找到了 IBAN 生成器。
Thanks in advance!
提前致谢!
采纳答案by Tim
Solution for Belgian IBAN bank account numbers:
比利时 IBAN 银行帐号的解决方案:
There exists a webservice for Belgian iban numbers, it's very easy to get the bic from the iban bank account number.
有一个比利时 iban 号码的网络服务,很容易从 iban 银行帐号中获取 bic。
$client = new SoapClient('http://www.ibanbic.be/IBANBIC.asmx?WSDL');
$bban = $client->getBelgianBBAN(array('Value' => $iban))->getBelgianBBANResult;
$bic = $client->BBANtoBIC(array('Value' => $bban))->BBANtoBICResult;
I've searched for a dutch webservice aswell, but I couldn't find one. But you can always make one yourself with the data from http://www.betaalvereniging.nl/europees-betalen/sepa-documentatie/bic-afleiden-uit-iban/
我也搜索了荷兰网络服务,但找不到。但是您总是可以使用来自http://www.betaalvereniging.nl/europees-betalen/sepa-documentatie/bic-afleiden-uit-iban/的数据自己制作一个
回答by Kiddo
Found solution for all IBAN accounts (I think):
为所有 IBAN 帐户找到解决方案(我认为):
https://openiban.com/validate/IBAN_NUMBER?getBIC=true
If you make a CURL call for example to that URL, you will get the Account bank info for free. Replace IBAN_NUMBERwith your IBAN account.
例如,如果您对该 URL 进行 CURL 调用,您将免费获得帐户银行信息。替换IBAN_NUMBER为您的 IBAN 帐户。
Example:
例子:
`https://openiban.com/validate/DE89370400440532013000?getBIC=true`
Result:
结果:
{
"valid": true,
"messages": [],
"iban": "DE89370400440532013000",
"bankData": {
"bankCode": "37040044",
"name": "Commerzbank",
"zip": "50447",
"city": "K?ln",
"bic": "COBADEFFXXX"
},
"checkResults": {}
}
Important Update
重要更新
OpenIBAN has shut down it's API servicedue to the GDPR regulations posing unknown risks on the service provider. See the statement on openIBAN.com. There is also a link to a self-hosting guide included, see this github page.
由于 GDPR 法规对服务提供商构成未知风险,OpenIBAN 已关闭其 API 服务。请参阅openIBAN.com上的声明。还有一个指向自托管指南的链接,请参阅此 github 页面。
Update (2019/07/25)
更新 (2019/07/25)
Openiban is back online.
Openiban 重新上线。
回答by Marc Wrobel
I do not think such library exists (at least for free).
我认为这样的库不存在(至少是免费的)。
The only reliable way to do this is by using the SWIFT IBAN Plus Directory(formely known as the SWIFT BICplusIBAN Directory.
唯一可靠的方法是使用SWIFT IBAN Plus 目录(以前称为SWIFT BICplusIBAN 目录)。
This directory is provided by SWIFT, which is the IBAN registrar. With it you can match IBAN to various institutions information (including BIC).
该目录由 IBAN 注册商 SWIFT 提供。有了它,您可以将 IBAN 与各种机构信息(包括 BIC)进行匹配。
The SWIFT IBAN Plus Directory is regularly updated by SWIFT with the latest data, is accessible as a file or via WebService APIs, and unfortunately is not available for free.
SWIFT IBAN Plus 目录由 SWIFT 定期更新最新数据,可作为文件或通过 Web 服务 API 访问,但遗憾的是不能免费提供。
回答by Wilgert
I created a Webservice that can convert both Dutch and Belgian IBAN to the corresponding BIC. More countries might be added in the future if that appears feasible.
我创建了一个 Web 服务,可以将荷兰语和比利时语 IBAN 转换为相应的 BIC。如果可行,将来可能会添加更多国家/地区。
Have a look at: http://iban2bic.nl
看看:http: //iban2bic.nl
Usage of the api: http://iban2bic.nl/api/:iban
api的用法:http: //iban2bic.nl/api/: iban
This website has been offline for a while. I have now open sourced the code here: https://bitbucket.org/wilgert/iban2bic
这个网站已经下线一段时间了。我现在在这里开源了代码:https: //bitbucket.org/wilgert/iban2bic
Disclaimer: the code is old and might contain bugs, stupid mistakes and/or security vulnerabilities. Furthermore the list of Dutch bank is far from complete because a large number of banks has been added since 2013.
免责声明:代码很旧,可能包含错误、愚蠢的错误和/或安全漏洞。此外,荷兰银行的名单还远未完成,因为自 2013 年以来增加了大量银行。
回答by Meint-Willem Gaasbeek
$json_url = 'http://iban2bic.nl/api/'.$iban_number_of_dutch_bank;
$json = file_get_contents($json_url);
$data = json_decode($json, TRUE);
$bic = $data['bic']; // holds the BIC number
回答by andrewxbg
There is no simple way to 'generate' BIC from an IBAN as BICs are independent number not present in the IBAN. ( Some countries have a part of the BIC in the IBAN ).
没有简单的方法可以从 IBAN 中“生成”BIC,因为 BIC 是 IBAN 中不存在的独立数字。(有些国家在 IBAN 中有 BIC 的一部分)。
There is a number of services providing such data. www.swift.com is a corporate service. Not very cheap though.
有许多服务提供此类数据。www.swift.com 是一项企业服务。虽然不是很便宜。
A good solution for small/medium businesses could be: https://www.iban.com/validation-api-v2.html
对于中小型企业来说,一个好的解决方案可能是:https: //www.iban.com/validation-api-v2.html
They have somewhat more flexible pricing plans.
他们有更灵活的定价计划。
回答by Maxim VA
I had a look around and found that you can retrieve the banks name from the iban number with this php iban validator:
我环顾四周,发现您可以使用这个 php iban 验证器从 iban 号码中检索银行名称:
http://code.google.com/p/php-iban/
http://code.google.com/p/php-iban/


But when you get there you would need an array with all the bank institution codes and corresponding BIC codes.
但是当你到达那里时,你需要一个包含所有银行机构代码和相应 BIC 代码的数组。
I think all the BIC codes can be found here:
我认为所有的 BIC 代码都可以在这里找到:
http://www.nbb.be/doc/gg/Protocol/R_List_of_Codes_Current.pdf
http://www.nbb.be/doc/gg/Protocol/R_List_of_Codes_Current.pdf
but i'm not sure how you can link the IBAN bank code to the list of BIC codes.
但我不确定如何将 IBAN 银行代码链接到 BIC 代码列表。
Didn't find a readymade library tough ..
没有找到一个现成的图书馆艰难..
回答by FlorianH
Readily get the BIC for a given IBAN:
轻松获取给定 IBAN 的 BIC:
https://www.ibancalculator.com/iban_validieren.html
https://www.ibancalculator.com/iban_validieren.html
Just used it for an IBAN and it gave me the seemingly correct, valid BIC for it.
只是将它用于 IBAN,它给了我看似正确、有效的 BIC。
I do not know whether the page's conversion can readily be automated.
我不知道页面的转换是否可以很容易地自动化。

