1. sayfa
<? 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 = '<strong>Sipariş Bilgisi</strong> <table> <tr><td>Müşteri</td><td>: <strong>'.$m1.'</strong></td></tr> <tr><td>Sipariş No</td><td>: <strong>'.$m2.'</strong></td></tr> <tr><td>Sipariş</td><td>: <strong>'.$m3.'</strong></td></tr> <tr><td>Tutar</td><td>: ₺ <strong>'.$m4.'</strong></td></tr> </table>'; if($mail->Send()){ header("Refresh: 5; url=profil.php"); } else { echo "Hata!: '.$mail->ErrorInfo.'"; }}} ?> <h5 style="color: green; text-align:center">Siparişiniz Kaydedildi</h5> <? 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 = '<strong>Sipariş Bilgisi</strong> <table> <tr><td>Müşteri</td><td>: <strong>'.$m1.'</strong></td></tr> <tr><td>Sipariş No</td><td>: <strong>'.$m2.'</strong></td></tr> <tr><td>Sipariş</td><td>: <strong>'.$m3.'</strong></td></tr> <tr><td>Tutar</td><td>: ₺ <strong>'.$m4.'</strong></td></tr> </table>'; if($mail->Send()){ header("Refresh: 5; url=profil.php"); } else { echo "Hata!: '.$mail->ErrorInfo.'"; }}} ?> <h5 style="color: green; text-align:center">Siparişiniz Kaydedildi</h5>
DH forumlarında vakit geçirmekten keyif alıyor gibisin ancak giriş yapmadığını görüyoruz. Üye olduğunda özel mesaj gönderebilir, beğendiğin konuları favorilerine ekleyip takibe alabilir ve daha önce gezdiğin konulara hızlıca erişebilirsin.
Api post dosyam. Nerede hata yapıyorum acaba? Postman ve benzeri plaformlarda sonuç normal. Yardımlarınız için teşekkür ederim.
DH forumlarında vakit geçirmekten keyif alıyor gibisin ancak giriş yapmadığını görüyoruz.
Üye Ol Şimdi DeğilÜye olduğunda özel mesaj gönderebilir, beğendiğin konuları favorilerine ekleyip takibe alabilir ve daha önce gezdiğin konulara hızlıca erişebilirsin.