if(isset($_POST['gonder'])){
$degiskenler.............
$sql=$db->query("INSERT INTO xxxxxx
(..................)
VALUES ('$.............')");
if ( $sql == true){
function CallAPI($method, $url, $data = false)
{
$header = array('Authorization: xxxxxxxxxxxxxx','From: xxxxx@xxxxxxxxxxxx.com');
$user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6';
$curl = curl_init();
switch ($method) {
case "GET":
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
if ($data) $url = sprintf("%s?%s", $url, http_build_query($data));
break;
case "POST":
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
break;
case "PUT":
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
break;
case "DELETE":
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
break;
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, $user_agent);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
return $response;
}
}
/**post kullanımı*/
$url = 'http://xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$data["customer"] = $tes_a;
$data["province_name"] = $il;
$data["county_name"] = $ilce;
$data["address"] = $t_adres;
$data["telephone"] = $mus_tel;
$data["branch_code"] = $kfirma;
//$data["barcode"] = 123456;
$data["amount"] = $bedel;
$data["summary"] = $siparis;
$data["quantity"] = 1;
$data["amount_type_id"] = 6;
$data["add_service_type_id"] = 2;
$data["order_number"] = $sip_no;
//$data["output_number"] = 1;
$data["seller"] = "xxxxxxxxxxxx";
print_r(CallAPI('POST', $url, $data));
CallAPI('POST', $url, $data);
include "mail/class.phpmailer.php";
include 'mail/mail_ayar.php';
$mail->AddAddress($xxxxxx);
$mail->AddAddress('xxxxx@xxxxx.com');
$mail->Subject = "xxxxxxxxxxx.com :: Sipariş Bildirimi";
$mail->Body = 'Sipariş Bilgisi
Müşteri : '.$m1.'
Sipariş No : '.$m2.'
Sipariş : '.$m3.'
Tutar : ₺ '.$m4.'
';
if($mail->Send()){
header("Refresh: 5; url=profil.php");
}
else {
echo "Hata!: '.$mail->ErrorInfo.'";
}}}
?>
Siparişiniz Kaydedildi
Merhaba,
Api post dosyam. Nerede hata yapıyorum acaba? Postman ve benzeri plaformlarda sonuç normal. Yardımlarınız için teşekkür ederim.