• 16-04-2013, 11:42:45
    #1
    Üyeliği durduruldu
    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/HTML; charset=utf-8" />
    
    <title>Kayan Yazı</title>
    </head>
    <body>
    <?php
    $genelhaber		 = 8;
    $genelhabers	 = "h";
    
    $yerelhaber		 = 7 ;
    $yerelhabers	 = "y";
    
    $sporhaber		 = 3;
    $sporhabers		 = "s";
    
    $ekonomi		 = 9;
    $ekonomi		 = "e";
    
    $kat = array ($genelhaber,$yerelhaber,$sporhaber,$ekonomi);
    $xml=simplexml_load_file("http://abone.iha.com.tr/yeniabone/RSS2.aspx?Kategori=8");
    
    $simge= "--h";
    $bosluk= "\r\n";
    echo  "$simge<br><br>";
    
    $dosya_dizin = "C:/";
    $dosya_adi = "$dosya_dizin/kayanhaber.txt";
    touch ("$dosya_dizin/$adi.txt") or die ("Dosya Yaratılamadı!") ;
    $dosya = fopen ($dosya_adi , 'w') or die ("Dosya açılamadı!");
    
    fwrite ( $dosya , $simge ) ;
    fwrite ( $dosya ,$bosluk);
    fwrite ( $dosya ,$bosluk);
    fwrite ( $dosya ,$bosluk);
    foreach($xml as $haberler)
    {
        $i = 0;
        foreach($haberler->item as $kaynak)
        {
            $hbr_baslik=$kaynak->title;
            $hbr_icerik=$kaynak->description;
    		$hbr_kodu=$kaynak->HaberKodu;
    		$hbr_aciklama=$kaynak->Aciklama;
            $hbr_link=$kaynak->link;
           
            if($i < 6)
            {    
                if(!strpos($hbr_icerik,"<IMG"))
                {
    			
    				list($bir, $iki, $uc) = split('<br/>', $hbr_icerik);
    				$karekter = strlen($bir);
    				
    				
    				$acik = $hbr_aciklama.$hbr_kodu;
    				$ybir = strtoupper($bir);
    				echo $bir.  "<br>";
    				$imza = "--*";
                   	echo  "$imza<br>";
    				
    				
                }
                else
                {
    				echo "<h4>".$hbr_aciklama."</h4><br>";
                }
    		fwrite ( $dosya ,$ybir);
    		fwrite ( $dosya ,$bosluk);
    		fwrite ( $dosya ,$imza);
    		fwrite ( $dosya ,$bosluk);
            }
    
    		$i++;
    		
    		
    
    		
    		
        }
    	
    }
    
    ?>
    
    </body>
    </html>

    $ybir = strtoupper($bir);
    bir değişkenini komple büyük yazdırıp txt ye kaydetmek istiyorum ama türkçe karekter sorunu yaşıyorum.
  • 16-04-2013, 12:14:20
    #2
    dosyayı utf-8 bomsuz olarak dönüştürerek deneyin.
  • 16-04-2013, 12:17:53
    #3
    Üyeliği durduruldu
    denedim olmadı
  • 17-04-2013, 00:27:34
    #4
    strtoupper türkçe karakter desteği olmayan bir fonksiyondur bu fonksiyonu kendiniz şekillendirip, kullanmanız lazım. örnek fonksiyon ,

    	function tr_ucwords($cumle) {
        $cumle = tr_toLower ( $cumle );
        if (preg_match_all ( '/(?P<i>(?:[ıİğĞüÜşŞöÖçÇ]|[^\s\n]))(?P<k>(?:[ıİğĞüÜşŞöÖçÇ]|[^\s\n]){0,})/siu', $cumle, $sonuc, PREG_PATTERN_ORDER )) {
            $cumle = "";
            foreach ( $sonuc ['i'] as $a => $harf ) {
                $cumle .= tr_toUpper ( $harf ) . $sonuc ['k'] [$a] . " ";
            }
        }
        return $cumle;
    	}
    	function tr_toUpper($cumle) {
    		return strtoupper ( str_replace ( array ('ı', 'i', 'ğ', 'ü', 'ş', 'ö', 'ç' ), array ('I', 'İ', 'Ğ', 'Ü', 'Ş', 'Ö', 'Ç' ), $cumle ) );
    	}
    	function tr_toLower($cumle) {
    		return strtolower ( str_replace ( array ('I', 'İ', 'Ğ', 'Ü', 'Ş', 'Ö', 'Ç' ), array ('ı', 'i', 'ğ', 'ü', 'ş', 'ö', 'ç' ), $cumle ) );
    	}