-
Notifications
You must be signed in to change notification settings - Fork 0
/
isBankasiPost.php
90 lines (65 loc) · 2.39 KB
/
isBankasiPost.php
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
require_once("isBankasiConf.php");
class isBankasi extends isBankasiConfClass
{
private $oid;
private $rand;
private $taksit="";
/* fatura bilgileri */
public $musteriTel;
public $musteriMail;
public $faturaAdi;
/* Fiyat Bilgileri */
public $tutar=100;
public $paraBirimiKodu = 949;
function isBankasiOdemeYap(){
$this->oid = microtime().rand(1000,100000);
$this->rand = microtime().rand(100,5000);
//HASH HESAPLAMA
$hashstr = self::clientid . $this->oid . $this->tutar . self::returnURL . self::returnURL .self::islemTipi. $this->taksit .$this->rand .self::storekey;
$hashCode = base64_encode(pack('H*',sha1($hashstr)));
//verileri array halinde topluyoruz.
$sendData = array(
"clientid"=>self::clientid ,
"storetype"=>self::storetype,
"storekey"=>self::storekey,
"hash"=>$hashCode,
"islemtipi"=>self::islemTipi,
"amount"=>$this->tutar,
"oid"=>$this->oid,
"currency"=>$this->paraBirimiKodu,
"okUrl"=>self::returnURL,
"failUrl"=> self::returnURL,
"lang"=>"tr",
"rnd"=>$this->rand,
"tel"=>$this->musteriTel,
"Email"=>$this->musteriMail,
"firmaadi"=>self::firmaAdi,
"Faturafirma"=>$this->faturaAdi,
"Fadres"=>self::firmaAdresi,
"Fadres2"=>self::firmaAdresi,
"Filce"=>self::firmaIlce,
"Fil"=>self::firmaSehir,
"Fpostakodu"=>self::firmaPostaKodu,
"Fulkekodu"=>self::ulkeKodu
);
//post edip urlyi izliyoruz.
$postdata = http_build_query($sendData);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, true); //POST Metodu kullanarak verileri gönder
curl_setopt($ch, CURLOPT_HEADER, false); //Serverdan gelen Header bilgilerini önemseme.
curl_setopt($ch, CURLOPT_URL, self::postURL); //Bağlanacağı URL
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); //POST verilerinin querystring hali. Gönderime hazır!
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //Transfer sonuçlarını return et. Onları kullanacağım!
curl_setopt($ch, CURLOPT_TIMEOUT, 20); //20 saniyede işini bitiremezsen timeout ol.
// curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
}
$isBank = new isBankasi;
echo $isBank->isBankasiOdemeYap();
?>