Garanti Odeme Kod
?
$xml= "<?xml version=\"1.0\" encoding=\"ISO-8859-9\"?>
<CC5Request>
<Name>kullanýcý adý yazýlacak</Name>
<Password>þifre yazýlacak</Password>
<ClientId>maðaza kodu yazýlacak</ClientId>
<IPAddress>{IP}</IPAddress>
<Email></Email>
<Mode>P</Mode>
<OrderId>{OID}</OrderId>
<GroupId></GroupId>
<TransId></TransId>
<UserId>{BILL}</UserId>
<Type>Auth</Type>
<Number>{CCNO}</Number>
<Expires>{CCTAR}</Expires>
<Cvv2Val>{CV2}</Cvv2Val>
<Total>{TUTAR}</Total>
<Currency>kur yazýlacak</Currency>
<Taksit>{TAKSIT}</Taksit>
<BillTo>
<Name>{BILL}</Name>
<Street1>{SHIP}</Street1>
<Street2></Street2>
<Street3></Street3>
<City></City>
<StateProv></StateProv>
<PostalCode></PostalCode>
<Country></Country>
<Company></Company>
<TelVoice></TelVoice>
</BillTo>
<ShipTo>
<Name></Name>
<Street1></Street1>
<Street2></Street2>
<Street3></Street3>
<City></City>
<StateProv></StateProv>
<PostalCode></PostalCode>
<Country></Country>
</ShipTo>
<Extra></Extra>
</CC5Request>
";
$lip=$_SERVER['REMOTE_ADDR'];
$oid= $_POST['oid'];
$ccno=$_POST['cardno'];
$ccay=$_POST['expmonth'];
$ccyil=$_POST['expyear'];
$tutar=$_POST['total'];
$acik=$_POST['isim'];//isim yazýlacak
$bolum="";
$cv2=$_POST['cv2'];
$taksit=$_POST['taksit'];
$xml=str_replace("{IP}",$lip,$xml);
$xml=str_replace("{OID}",$oid,$xml);
$xml=str_replace("{CCNO}",$ccno,$xml);
$xml=str_replace("{CCTAR}","$ccay/$ccyil",$xml);
$xml=str_replace("{CV2}","$cv2",$xml);
$xml=str_replace("{TUTAR}",$tutar,$xml);
$xml=str_replace("{BILL}",$acik,$xml);
$xml=str_replace("{SHIP}",$bolum,$xml);
$xml=str_replace("{TAKSIT}",$taksit,$xml);
//// card icin baglanma komut:
$curl = `/usr/bin/curl -s -d 'DATA=$xml' "https://ccpos.garanti.com.tr/servlet/cc5ApiServer"`;
$dat=explode("\n",$curl);
//echo nl2br(htmlspecialchars($xml));
$return_code = "";
foreach ($dat as $da)
{
$i=strpos($da,">");
$j=strrpos($da,"<");
$x=strpos($da,"<");
$key= substr($da,$x+1,$i-$x-1);
$val= substr($da,$i+1,$j-$i-1);
$ret[$key]=$val;
//echo "$key:$val <br>";
if ($key == "ProcReturnCode")
{
$return_code = $val;
break;
}
}
if ($return_code == "0")
$success = true;
else
$success = false;
//echo "return_code: ".$return_code.'<br>';
if ($success)
{
//basarili islem
}
else
{
//basarisiz islem
}
?>