• 08-07-2015, 20:24:46
    #1
    Merhabalar php de yeniyim ilk defa curl kullandım bugün localhostta her şey güzel sorunsuz fakat siteye atınca sorun yaptı. Kodlar aşağıda localhostta çalışıyor. Nedeni nedir ? Host curl destekliyor bu arada.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Google Botunun Son Ziyareti</title>
    <meta http-equiv="Content-Type" content="text/HTML; charset=utf-8" />
    <link href="/sonindeks/style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    
    
    
    <div id="iso">
    
    <?php  
    
    
    $adres			= $_POST["adres"];
    
    
    
    //get googlebot last access
    function googlebot_lastaccess($adres)
    {
      $request = 'http://webcache.googleusercontent.com/search?hl=en&q=cache:'.$adres.'&btnG=Google+Search&meta=';
        $data = getPageData($request);
        $data = getPageData($request);
        $spl=explode("appeared on",$data);
       //echo "<pre>".$spl[0]."</pre>";
        $spl2=explode("GMT",$spl[1]);
        $value=trim($spl2[0]);
       //echo "<pre>".$spl2[0]."</pre>";
        if(strlen($value)==0)
        {
            return(0);
        }
        else
        {
            return($value);
        }      
    } 
    
    echo "Google Botunun Son Ziyareti </br></br> ".googlebot_lastaccess($adres)."<br />"; 
    
    
    
    function getPageData($url) {
     if(function_exists('curl_init')) {
     $ch = curl_init($url); // initialize curl with given url
     curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // add useragent
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // write the response to a variable
     if((ini_get('open_basedir') == '') && (ini_get('safe_mode') == 'Off')) {
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow redirects if any
     }
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); // max. seconds to execute
     curl_setopt($ch, CURLOPT_FAILONERROR, 1); // stop when it encounters an error
     return @curl_exec($ch);
     }
     else {
     return @file_get_contents($url);
     }
    }
    
    
    
    ?></div>
    
    </body>
    </html>

    Not : Bir de aynı işlevi farklı bir yoldan yapmıştım bu da localhostta sorunsuz fakat hosta atınca çekemiyor veri. : http://notes.io/quLQ
  • 08-07-2015, 20:32:30
    #2
    hata vermiyor mu?

    sayfanin en ustune

    <?php
    error_reporting(E_ALL); ini_set('display_errors', 1);
    ?>
    ekleyin hata varsa gorursunuz
  • 08-07-2015, 20:39:25
    #3
    LaCReMeL adlı üyeden alıntı: mesajı görüntüle
    hata vermiyor mu?

    sayfanin en ustune

    <?php
    error_reporting(E_ALL); ini_set('display_errors', 1);
    ?>
    ekleyin hata varsa gorursunuz
    Hocam verdiğiniz dosyayı koydum kodu hata gösterdi : Warning: ini_set() has been disabled for security reasons in /home/warezdos/public_html/ilkdeneme/sonuc.php on line 2

    bu arada scriptler bunlar. biri curl diğeri başka : http://www74.zippyshare.com/v/OFzg0cWq/file.html
  • 08-07-2015, 22:23:24
    #4
    <?php 
    error_reporting(E_ALL);
    ?>
    ini_set kapatilmis sunucuda. su sekilde koyun en uste
    Karakurt adlı üyeden alıntı: mesajı görüntüle
    Hocam verdiğiniz dosyayı koydum kodu hata gösterdi : Warning: ini_set() has been disabled for security reasons in /home/warezdos/public_html/ilkdeneme/sonuc.php on line 2

    bu arada scriptler bunlar. biri curl diğeri başka : http://www74.zippyshare.com/v/OFzg0cWq/file.html
  • 08-07-2015, 22:26:10
    #5
    Üyeliği durduruldu
    Belki hata farklı olabilir ama bazı scriptler artık yeni sürüm php sürümleriyle çalışmakta 5.4 üstü bir hosting denedinizmi ?
  • 08-07-2015, 22:33:19
    #6
    zuqasibere adlı üyeden alıntı: mesajı görüntüle
    Belki hata farklı olabilir ama bazı scriptler artık yeni sürüm php sürümleriyle çalışmakta 5.4 üstü bir hosting denedinizmi ?
    PHP Version 5.4.27 şuan. Saçma olan script şuan çalıştı değişiklik yapmamama rağmen. demo : http://ismail.party/sonindeks/ . Acaba içeriği googledan çektiğim için google engel falan mı koyuyor arada ?
  • 08-07-2015, 22:37:30
    #7
    Üyeliği durduruldu
    Karakurt adlı üyeden alıntı: mesajı görüntüle
    PHP Version 5.4.27 şuan. Saçma olan script şuan çalıştı değişiklik yapmamama rağmen. demo : http://ismail.party/sonindeks/ . Acaba içeriği googledan çektiğim için google engel falan mı koyuyor arada ?
    Bazen Cash Bellektende Böyle sorunlarla karşılaşılabiliyor.
  • 08-07-2015, 22:37:57
    #8
    <?php 
    error_reporting(E_ALL);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <title>Google Botunun Son Ziyareti</title> 
    <meta http-equiv="Content-Type" content="text/HTML; charset=utf-8" /> 
    <link href="/sonindeks/style.css" rel="stylesheet" type="text/css" /> 
    </head> 
    <body> 
    <div id="iso"> 
    <?php
    $adres = $_POST["adres"];
    //get googlebot last access
    function googlebot_lastaccess($adres)
    {
        $request = 'http://webcache.googleusercontent.com/search?hl=en&q=cache:'.$adres.'&btnG=Google+Search&meta=';
        $data = getPageData($request);
        $spl = explode("appeared on", $data);
        $spl2 = explode("GMT", $spl[1]);
        $value = trim($spl2[0]);
        return $value;
    }
    
    echo "Google Botunun Son Ziyareti </br></br> " . googlebot_lastaccess($adres) .  "<br />";
    
    function getPageData($url)
    {
        $ch = curl_init($url); // initialize curl with given url
        curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // add useragent
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // write the response to a variable
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); // max. seconds to execute
        $return = curl_exec($ch);
        curl_close($ch);
        return $return;
    }
    ?>
    </div> 
    
    </body> 
    </html>

    bu sekilde bir deneyin
  • 08-07-2015, 22:47:33
    #9
    LaCReMeL adlı üyeden alıntı: mesajı görüntüle
    <?php 
    error_reporting(E_ALL);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <title>Google Botunun Son Ziyareti</title> 
    <meta http-equiv="Content-Type" content="text/HTML; charset=utf-8" /> 
    <link href="/sonindeks/style.css" rel="stylesheet" type="text/css" /> 
    </head> 
    <body> 
    <div id="iso"> 
    <?php
    $adres = $_POST["adres"];
    //get googlebot last access
    function googlebot_lastaccess($adres)
    {
        $request = 'http://webcache.googleusercontent.com/search?hl=en&q=cache:'.$adres.'&btnG=Google+Search&meta=';
        $data = getPageData($request);
        $spl = explode("appeared on", $data);
        $spl2 = explode("GMT", $spl[1]);
        $value = trim($spl2[0]);
        return $value;
    }
    
    echo "Google Botunun Son Ziyareti </br></br> " . googlebot_lastaccess($adres) .  "<br />";
    
    function getPageData($url)
    {
        $ch = curl_init($url); // initialize curl with given url
        curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // add useragent
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // write the response to a variable
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); // max. seconds to execute
        $return = curl_exec($ch);
        curl_close($ch);
        return $return;
    }
    ?>
    </div> 
    
    </body> 
    </html>

    bu sekilde bir deneyin
    Herhangi bir hata kodu vermedi. Nedense birden çalışmaya başladı : http://ismail.party/sonindeks/ . sanırım çalışmamasının nedeni googledan kaynaklanıyordu. User agent sorun olabilir diye tarayıcı olarak gösterdim useragenti. Şuan sorunsuz tekrar bozulmak inşallah.