• 09-02-2021, 03:59:29
    #1
    Merhaba arkadaşlar ;
    Bir site üzerinden günlük resim çekiyorum sisteme.Resimler her gün güncelleniyor sadece site üzerinde gösteriyorum,oluşturulan resim linkinden kayıt yapmıyorum.
    ama yeni resimler yüklenirken 7-8 saatlik bir boşluk oluyor . Bu süreçte linkte resim yoksa kendi belirliyeceğim bir resimi nasıl gösterebilirim ?

    Çok teşekkür ediyorum şimdiden
  • 09-02-2021, 04:21:29
    #2
    Üyeliği durduruldu
    <?php
    
    $resim = gelenresim();
    if ( !empty($resim) ) {
       $yeniresim = $resim;
    } else {
       $yeniresim = 'resim yoksa beni göster';
    }
    echo $yeniresim;
    
    ?>
  • 09-02-2021, 04:22:30
    #3
    Çok teşekkür ederim hocam
  • 09-02-2021, 05:25:39
    #4
    Üyeliği durduruldu
    Pandacado adlı üyeden alıntı: mesajı görüntüle
    Çok teşekkür ederim hocam
    Özel mesaj ile yardım istemişsin. Sana yardım ettim ancak cevabını buraya yazıyorum ki, ihtiyacı olan herkes faydalansın.

    Senin talebin:
    <?php
    
    $bosgazte ="fotomac";
    $glink = $_POST['gazatebaslik'];
    if( $glink = $_POST['gazatebaslik'] ){
    $gbaslik = $gdetay[1];
    $gazetetarih = date("dmy");
    
    echo '<a href="[URL]https://i13.haber7.net/haber7/gazete/'.$bosgazte.'/big_'.$gazetetarih.'_0800.jpg?'.$gazetetarih.'_080[/URL] 0"><img src="[URL]https://i13.haber7.net/haber7/gazete/'.$bosgazte.'/big_'.$gazetetarih.'_0800.jpg?'.$gazetetarih.'_080[/URL] 0" width="450px" height="250px"></a> ';
    echo '<br>';
    echo '<a href="[URL]https://i13.haber7.net/haber7/gazete/'.$bosgazte.'/big_'.$gazetetarih.'_0800.jpg?'.$gazetetarih.'_080[/URL] 0" >Büyük Ekran Yap</a>';
    
    
    } else
    {
    $gazetetarih = date("dmy");
    
    echo '<a href="[URL]https://i13.haber7.net/haber7/gazete/'.$bosgazte.'/big_'.$gazetetarih.'_0800.jpg?'.$gazetetarih.'_080[/URL] 0"><img src="[URL]https://i13.haber7.net/haber7/gazete/'.$bosgazte.'/big_'.$gazetetarih.'_0800.jpg?'.$gazetetarih.'_080[/URL] 0" width="450px" height="250px"></a> ';
    echo '<br>';
    echo '<a href="[URL]https://i13.haber7.net/haber7/gazete/'.$bosgazte.'/big_'.$gazetetarih.'_0800.jpg?'.$gazetetarih.'_080[/URL] 0"" >Büyük Ekran Yap</a>';
    
    }
    
    ?>
    Benim yazdığım ve çalışan kod:

    function getIMG($url){
    $userAgent = $_SERVER['HTTP_USER_AGENT'];
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_FAILONERROR, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    $html = curl_exec($ch);
    if ( !$html ) {
    return curl_errno($ch);
    } else {
    return $html;
    }
    }
    
    function tarihget(){
    $gun = date("d");
    $ay = date("m");
    $yil = date("Y");
    $yil = str_replace("0", "", $yil);
    $data = $gun . $ay . $yil;
    return $data;
    }
    
    $glink = $_POST['gazatebaslik'];
    $tarih = tarihget();
    
    if ( !empty($glink) ) {
    $url = 'https://i13.haber7.net/haber7/gazete/'.$glink.'/big_'.$tarih.'_0800.jpg?v='.$tarih.'_080';
    $x_url = 'https://cdn.r10.net/ogmeta.png';
    $imgData = getIMG($url);
    if ( $imgData != 22 ) {
    echo '<a href="'.$url.'"><img src="'.$url.'" width="450px" height="250px"></a><br /><a href="'.$url.'" >Büyük Ekran Yap</a>';
    } else {
    echo '<a href="'.$x_url.'"><img src="'.$x_url.'" width="450px" height="250px"></a><br /><a href="'.$x_url.'" >Büyük Ekran Yap</a>';
    }
    } else {
    echo 'form post edilmedi';
    }
  • 09-02-2021, 05:38:42
    #5
    Kodu senin yazdığın gibi çalıştırdığım zaman form post edilmedi yazıyor normalde https://cdn.r10.net/ogmeta.png göstermesi lazım değil mi ?