code iban 是有什么组成_国际银行账号(IBAN)

本文展示了如何通过API请求验证国际银行账号(IBAN),包括使用curl、PHP、Ruby、Python、Perl、Java、.NET和Node.js发起POST请求来获取银行详细信息。
摘要由CSDN通过智能技术生成

curl "https://api.iban.com/clients/api/v4/iban/" \

-X POST \

-d format=json \

-d api_key=[YOUR_API_KEY] \

-d iban=DE46500700100927353010

$curl = curl_init();

$post = [

'format' => 'json',

'api_key' => '[YOUR_API_KEY]',

'iban' => 'DE46500700100927353010',

];

curl_setopt_array($curl, array(

CURLOPT_URL => 'https://api.iban.com/clients/api/v4/iban/',

CURLOPT_RETURNTRANSFER => true,

CURLOPT_POSTFIELDS => $post

));

$output = curl_exec($curl);

$result = json_decode($output);

print_r($result);

curl_close($curl);

?>

require 'net/http'

uri = URI('https://api.iban.com/clients/api/v4/iban/')

res = Net::HTTP.post_form(uri, "format" => "json", "api_key" => "[YOUR_API_KEY]","iban" => "DE46500700100927353010")

puts res.body

import requests

post_data = {'format':'json', 'api_key':'[YOUR_API_KEY]','iban':'DE46500700100927353010'}

response = requests.post('https://api.iban.com/clients/api/v4/iban/',post_data)

print(response.text)

use LWP::UserAgent;

my $ua = LWP::UserAgent->new;

my $server_endpoint = "https://api.iban.com/clients/api/v4/iban/";

my $format = 'json';

my $api_key = '[YOUR_API_KEY]';

my $iban = 'DE02100500000024290661';

my $req = HTTP::Request->new( POST => $server_endpoint );

$req->content_type('application/x-www-form-urlencoded');

my $post_data = 'format=' . $format . '&api_key=' . $api_key . '&iban=' . $iban;

$req->content($post_data);

my $resp = $ua->request($req);

if ( $resp->is_success ) {

my $message = $resp->decoded_content;

print $message;

}

JAVA

import java.io.BufferedReader;

import java.io.DataOutputStream;

import java.io.InputStreamReader;

import java.net.HttpURLConnection;

import java.net.URL;

import javax.net.ssl.HttpsURLConnection;

import org.json.simple.JSONObject;

import org.json.simple.JSONArray;

import org.json.simple.parser.ParseException;

import org.json.simple.parser.JSONParser;

public class ibanapi {

private final String USER_AGENT = "API Client/1.0";

public static void main(String[] args) throws Exception {

ibanapi http = new ibanapi();

System.out.println("\nTesting API - Send API POST request");

http.sendPost();

}

// HTTP POST request

private void sendPost() throws Exception {

String url = "https://api.iban.com/clients/api/v4/iban/";

URL obj = new URL(url);

HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();

//add reuqest header

con.setRequestMethod("POST");

con.setRequestProperty("User-Agent", USER_AGENT);

con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");

String urlParameters = "api_key=[YOUR_API_KEY]&format=json&iban=DE02100500000024290661";

// Send post request

con.setDoOutput(true);

DataOutputStream wr = new DataOutputStream(con.getOutputStream());

wr.writeBytes(urlParameters);

wr.flush();

wr.close();

int responseCode = con.getResponseCode();

System.out.println("\nSending 'POST' request to URL : " + url);

System.out.println("Post parameters : " + urlParameters);

System.out.println("Response Code : " + responseCode);

BufferedReader in = new BufferedReader(

new InputStreamReader(con.getInputStream()));

String inputLine;

StringBuffer response = new StringBuffer();

while ((inputLine = in.readLine()) != null) {

response.append(inputLine);

}

in.close();

//print result

System.out.println(response.toString());

}

}

.NET

public static void Main(string[] args)

{

var request = (HttpWebRequest)WebRequest.Create("https://api.iban.com/clients/api/v4/iban/");

var postData = "api_key=[YOUR_API_KEY]";

postData += "&format=json";

postData += "&iban=DE02100500000024290661";

var data = Encoding.ASCII.GetBytes(postData);

request.Method = "POST";

request.ContentType = "application/x-www-form-urlencoded";

request.ContentLength = data.Length;

using (var stream = request.GetRequestStream())

{

stream.Write(data, 0, data.Length);

}

var response = (HttpWebResponse)request.GetResponse();

var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();

Console.WriteLine(responseString);

Console.Write("Press any key to continue . . . ");

Console.ReadKey(true);

}

NODE

var request = require('request');

var headers = {

'User-Agent': 'IBAN API Client/0.0.1',

'Content-Type': 'application/x-www-form-urlencoded'

}

var options = {

url: 'https://api.iban.com/clients/api/v4/iban/',

method: 'POST',

headers: headers,

form: {'api_key': '[YOUR_API_KEY]', 'format': 'json', 'iban': 'GB04BARC20474473160944'}

}

request(options, function (error, response, body) {

if (!error && response.statusCode == 200) {

var data = JSON.parse(body);

console.log(data.errors);

console.log("Bank Name: " + data.bank_data.bank);

console.log("Bank BIC: " + data.bank_data.bic);

console.log("Bank City: " + data.bank_data.city);

console.log("Bank Address: " + data.bank_data.address);

console.log("Bank Zip: " + data.bank_data.zip);

console.log("Bank Phone: " + data.bank_data.phone);

console.log("Bank FAX: " + data.bank_data.fax);

console.log("Bank www: " + data.bank_data.www);

console.log("Bank email: " + data.bank_data.email);

console.log("Bank Country Name: " + data.bank_data.country);

console.log("Bank Country Code: " + data.bank_data.country_iso);

console.log("Domestic Account Number: " + data.bank_data.account);

}

})

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值