• 27-05-2017, 03:54:40
    #1
    arkadaşlar benim iki tane sitem var. A sitesinden B sitesine veri gönderiyorum curl ile ama b sitesinden geri dönüşü nasıl yapacam. örnek vermek gerekirse.

    $url = "https://www.bsitesi.com/kontrol.php";
    $post_veri = array(
      'username' => "admin"
    );
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$post_veri);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER["HTTP_USER_AGENT"]);
    $veri = curl_exec($ch);
    curl_close ($ch);
    echo $veri;
    A sitesinden admin kullanıcı adını b sitesindeki kontrol.php sayfasına post ediyorum. B sitesinde de gelen username adını alıp databasenden üyeler tablosundan bulup e-mail adresini geri dönmek istiyorum. Bunu nasıl yaparım.

    yardımcı olabilir misiniz.
  • 27-05-2017, 09:35:17
    #2
    Merhaba, aşağıda sizin için örnek bir betik hazırladım, takıldığınız yer olursa özel mesaj gönderebilirsiniz.

    $ara = mysql_query("SELECT `email` FROM `users` where `username`='" . mysql_real_escape_string($_POST['username']) . "'");
    if (!@mysql_num_rows($ara)) {
        while ($satir = mysql_fetch_array($ara, MYSQL_ASSOC)) {
            echo $satir['email'];
        }
    } else {
        echo 'Yok';
    }
  • 27-05-2017, 13:00:43
    #3
    hocam çok teşekkür ederim işime o kadar yaradıki anlatamam