• 27-06-2017, 16:09:51
    #1
    Arkadaşlar merhaba,

    phpmailer fonksiyonu sorunsuz çalışıyor, sadece recaptcha ile phpmail komutlarını nasıl birleştirebilirim, yani recaptcha doğru girildiği zaman phpmailer çalışacak ve maili gönderecek.

    if ($_POST) {
    $secretKey = "6LdV5AITAAAAAOwG3lVIjKHklZg8wELGUlXRbuYR";
    $ip = $_SERVER['REMOTE_ADDR'];
    $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
    $responseKeys = json_decode($response,true);
    if(intval($responseKeys["success"]) !== 1) {
    
    if(isset($_POST['ad']) && isset($_POST['eposta']) && isset($_POST['konu']) && isset($_POST['mesaj']) && isset($_POST['g-recaptcha-response'])) {
    function epostakontrol($email){if (filter_var($email, FILTER_VALIDATE_EMAIL)){return 1;} else {return 0;}} 
    $gelen_mail = $_POST['eposta']; $mail_kontol=epostakontrol($gelen_mail);
    	
    if(empty($_POST['ad']) || empty($_POST['eposta']) || empty($_POST['konu']) || empty($_POST['mesaj'])) {
    echo '<h5>Lütfen boş yer bırakmayın.</h5>';
    } else if($mail_kontol == "0"){echo '<h5>Lütfen e-posta adresini doğru girin.</h5>';} else{
    include 'PHPMailerAutoload.php';
    $phpmailer = new PHPMailer;
    $phpmailer->isSMTP();
    $phpmailer->Host = 'mail.mail.com.tr';
    $phpmailer->SMTPAuth = true;
    $phpmailer->Username = 'eposta@eposta.com';
    $phpmailer->Password = 'şifre';
    $phpmailer->SMTPSecure = 'tls';
    $phpmailer->Port = '587';
    $phpmailer->From = 'eposta@eposta.com';
    $phpmailer->FromName = 'Iletisim Formu';
    $phpmailer->AddReplyTo($_POST['ad'], $_POST['eposta'], $_POST['tel'], $_POST['konu']);
    $phpmailer->addAddress('eposta@eposta.com', 'Iletisim Formu');
    $phpmailer->Subject = $_POST['konu'];
    $phpmailer->isHTML(true);
    
    $ad = $_POST['ad'];
    $eposta = $_POST['eposta'];
    $tel = $_POST['tel'];
    $konu = $_POST['konu'];
    $mesaj = $_POST['mesaj'];
    
    $msg=$msg.'<h3>Ad Soyad	: </h3>'.$ad."<br />";
    $msg=$msg.'<h3>E-Mail	: </h3>'.$eposta."<br />";
    $msg=$msg.'<h3>Telefon	: </h3>'.$tel."<br />";
    $msg=$msg.'<h3>Konu		: </h3>'.$konu."<br />";
    $msg=$msg.'<h3>Mesaj	: </h3>'.$mesaj."\n";
    
    $body = $msg;
    $phpmailer->CharSet = 'iso-8859-1';
    $phpmailer->MsgHTML($body);
    if($phpmailer->Send()) { echo '<h5>Mesajınız başarıyla gönderildi.</h5>';} 
    else { echo '<h5>Mesaj gönderirken bir hata oluştu ve girmiş olduğunuz bilgiler alınamadı.</h5>' . $phpmailer->ErrorInfo;}
    }
    }
    }
    }
  • 30-06-2017, 23:32:40
    #2
    <?php
    $secret = "";
    $api = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']);
    if ($api.success == true) {
        //başarılı
    } else {
        //başarısız
    }
    
    ?>
  • 01-07-2017, 00:02:50
    #3
    hata veriyor maalesef

    PHP Warning:  file_get_contents(https://www.google.com/recaptcha/api/siteverify?secret=xxxxxxxxxx&amp;response=&amp;remoteip=195xxxxx): failed to open stream: no suitable wrapper could be found in /home/
    ilginçtir komut her koşulda true değerini gösteriyor
  • 01-07-2017, 09:11:47
    #4
    hlttmz adlı üyeden alıntı: mesajı görüntüle
    hata veriyor maalesef

    PHP Warning:  file_get_contents(https://www.google.com/recaptcha/api/siteverify?secret=xxxxxxxxxx&amp;response=&amp;remoteip=195xxxxx): failed to open stream: no suitable wrapper could be found in /home/
    ilginçtir komut her koşulda true değerini gösteriyor
    true yerıne false deneyıp else değerini başarılı yapar mısın
  • 03-07-2017, 00:13:10
    #5
    valla ilginç, yine true değerini gösteriyor, ama error_log dosyasından aldığım warning kısmındaki siteverify kısmını tarayıcıda açtığımda, captcha doğruladığımda bile tarayıcıda hep aynı değer görünüyor.
    {
    "success": false,
    "error-codes": [
    "missing-input-response"
    ]
  • 03-07-2017, 01:10:02
    #6
    if (isset($_POST['g-recaptcha-response'])) {
        $captcha = $_POST['g-recaptcha-response'];
    }
    if (!$captcha) {
        echo '<script>alert("Lütfen robot olmadığınızı doğrulayın.");</script>';
        exit;
    }
    $kontrol = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=XXXXXXXXXXXXXXX&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']);
    if ($kontrol) {
    //MAil gönderme işlemin
    }else{
    //SPAM GÖNDERİ 
    }
  • 04-07-2017, 00:03:27
    #7
    özür dileyerek tekrar yazıyorum fakat sürekli false komutunu çalıştırıyor ve aynı şekilde error_log hatası

    "failed to open stream: no suitable wrapper could be found in"

    demekte.. araştırdığım kadarıyla curl fonksiyonu kullanmak gerekiyor ama bunun da örneği yok
  • 04-07-2017, 01:45:32
    #8
    Üyeliği durduruldu
    Düz PHP Captcha da kullanabilirsiniz oldukça basit google da araştırabilirsiniz.
  • 04-07-2017, 23:55:29
    #9
    sorunu halen çözemedim maalesef