forked from yajinn/iyzico-bin-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiyzico_bin.php
More file actions
36 lines (29 loc) · 708 Bytes
/
iyzico_bin.php
File metadata and controls
36 lines (29 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* BIN Checker Sample
*
* @author iyzico Entegrasyon
*
*/
$api_id = 'IYZI_API_ID';
$secret = 'IYZICO_SECRET';
$bin = 'BIN_NUMBER_TO_CHECK';
$url = 'https://api.iyzico.com/bin-check';
$data = "api_id=".$api_id.
"&secret=".$secret.
"&bin=".$bin;
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg");
}
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("problem reading data from $url, $php_errormsg");
}
$resultJson = json_decode($response);
print_r($resultJson);