Php ile Xml'den Veri Okuyup Kayıt Almak

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

redblue58

Katılımcı Üye
26 Ocak 2008
910
2
İzmir
Hocam öncelikle merhaba,

http://tr.hititbet.com/GetLiveBet
burada bir xml Dosyası var.
Kod:
<?xml version="1.0" encoding="ISO-8859-9" ?><xml><cal><day id="" day="10" date="2012-10-10 00:00:00.0" matchNo="22" dateId="121010" nots="" /><day id="" day="11" date="2012-10-11 00:00:00.0" matchNo="20" dateId="121011" nots="" /><day id="" day="12" date="2012-10-12 00:00:00.0" matchNo="27" dateId="121012" nots="" /><day id="" day="13" date="2012-10-13 00:00:00.0" matchNo="18" dateId="121013" nots="" /><day id="" day="14" date="2012-10-14 00:00:00.0" matchNo="11" dateId="121014" nots="" /><day id="" day="15" date="2012-10-15 00:00:00.0" matchNo="0" dateId="121015" nots="" /><day id="" day="16" date="2012-10-16 00:00:00.0" matchNo="0" dateId="121016" nots="" /></cal><sportTypes lastCounter="234" total="22"><sportType id="1" name="Futbol"><match id="733657" seasonId="2047" groupId="0" fixId="733657" sprotTypeId="1"  homeName="Geylang United"  homeId="11830"  awayName="Gombak United"  awayId="11829"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="14:45"  startDateStamp="1210101445"  titleName="2012 Singapur S-Ligi" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="728675" seasonId="2644" groupId="5200" fixId="728675" sprotTypeId="1"  homeName="Greece U19"  homeId="5752"  awayName="Moldova U19"  awayId="8141"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="16:00"  startDateStamp="1210101600"  titleName="2012-2013 UEFA U19 Championship - Group 4" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="723242" seasonId="2551" groupId="5061" fixId="723242" sprotTypeId="1"  homeName="Siofok"  homeId="7518"  awayName="Paks"  awayId="7014"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="16:00"  startDateStamp="1210101600"  titleName="2012-2013 Hungary League Cup - Group B" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="732182" seasonId="2631" groupId="5174" fixId="732182" sprotTypeId="1"  homeName="Ganvix Turi"  homeId="17986"  awayName="Velldoris"  awayId="17992"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="16:00"  startDateStamp="1210101600"  titleName="2012-2013 Estonia round 16" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="723255" seasonId="2551" groupId="5063" fixId="723255" sprotTypeId="1"  homeName="MTK Budapest"  homeId="7011"  awayName="Kecskemeti"  awayId="8020"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="16:00"  startDateStamp="1210101600"  titleName="2012-2013 Hungary League Cup - Group D" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="726954" seasonId="2635" groupId="0" fixId="726954" sprotTypeId="1"  homeName="Kallithea"  homeId="920"  awayName="Anagennisi Gianitson"  awayId="12939"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="16:45"  startDateStamp="1210101645"  titleName="2012-2013 Yunanistan B Ethniki Ligi" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="721652" seasonId="2542" groupId="5138" fixId="721652" sprotTypeId="1"  homeName="Slavoj Vysehrad"  homeId="8894"  awayName="Teplice"  awayId="668"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="17:00"  startDateStamp="1210101700"  titleName="2012-2013 Czech Cup - Third Round" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="726960" seasonId="2635" groupId="0" fixId="726960" sprotTypeId="1"  homeName="Visas Megaron"  homeId="14550"  awayName="Ethnikos Gazorou"  awayId="17917"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="17:30"  startDateStamp="1210101730"  titleName="2012-2013 Yunanistan B Ethniki Ligi" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="723256" seasonId="2551" groupId="5063" fixId="723256" sprotTypeId="1"  homeName="Ferencvaros"  homeId="2051"  awayName="Szolnoki Mav"  awayId="9899"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="19:00"  startDateStamp="1210101900"  titleName="2012-2013 Hungary League Cup - Group D" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="728676" seasonId="2644" groupId="5200" fixId="728676" sprotTypeId="1"  homeName="Czech Republic U19"  homeId="6200"  awayName="Northern Ireland U19"  awayId="5751"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="21:00"  startDateStamp="1210102100"  titleName="2012-2013 UEFA U19 Championship - Group 4" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="669887" seasonId="2188" groupId="0" fixId="669887" sprotTypeId="1"  homeName="Stockport"  homeId="312"  awayName="Wrexham"  awayId="152"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="21:45"  startDateStamp="1210102145"  titleName="2012-2013 Ingiltere Konferans Ligi" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="733654" seasonId="2222" groupId="5135" fixId="733654" sprotTypeId="1"  homeName="Shelbourne"  homeId="1399"  awayName="Derry City"  awayId="1401"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="22:00"  startDateStamp="1210102200"  titleName="2012 Irish FAI Cup - SemiFinals" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /></sportType><sportType id="3" name="Tenis"><match id="734257" seasonId="2667" groupId="0" fixId="734257" sprotTypeId="3"  homeName="Richard Gasquet"  homeId="1798"  awayName="Radek Stepanek"  awayId="1134"  score="0-0"  foul="0-0"  status="SCH"  nots="Hitit TV Cyprus"  startDate="12:30"  startDateStamp="1210101230"  titleName="2012 Shanghai Masters Series" timerMin="-" tvId="768243" scoreSet="-" scoreHeader="." /><match id="734259" seasonId="2667" groupId="0" fixId="734259" sprotTypeId="3"  homeName="Janko Tipsarevic"  homeId="5075"  awayName="Viktor Troicki"  awayId="7777"  score="0-0"  foul="0-0"  status="SCH"  nots="Hitit TV Cyprus"  startDate="14:00"  startDateStamp="1210101400"  titleName="2012 Shanghai Masters Series" timerMin="-" tvId="768243" scoreSet="-" scoreHeader="." /><match id="733205" seasonId="2665" groupId="0" fixId="733205" sprotTypeId="3"  homeName="Victoria Azarenka"  homeId="6984"  awayName="Arantxa Rus"  awayId="7923"  score="0-0"  foul="0-0"  status="SCH"  nots="Hitit TV Cyprus"  startDate="17:00"  startDateStamp="1210101700"  titleName="2012 Linz WTA" timerMin="-" tvId="768251" scoreSet="-" scoreHeader="." /><match id="733211" seasonId="2665" groupId="0" fixId="733211" sprotTypeId="3"  homeName="Patricia Mayr-Achleitner"  homeId="9187"  awayName="Sabine Lisicki"  awayId="7301"  score="0-0"  foul="0-0"  status="SCH"  nots="Hitit TV Cyprus"  startDate="18:00"  startDateStamp="1210101800"  titleName="2012 Linz WTA" timerMin="-" tvId="768251" scoreSet="-" scoreHeader="." /><match id="733212" seasonId="2665" groupId="0" fixId="733212" sprotTypeId="3"  homeName="Monica Niculescu"  homeId="7672"  awayName="Ana Ivanovic"  awayId="5949"  score="0-0"  foul="0-0"  status="SCH"  nots="Hitit TV Cyprus"  startDate="20:30"  startDateStamp="1210102030"  titleName="2012 Linz WTA" timerMin="-" tvId="768251" scoreSet="-" scoreHeader="." /></sportType><sportType id="12" name="Buz Hokeyi"><match id="678063" seasonId="2369" groupId="0" fixId="678063" sprotTypeId="12"  homeName="Amur Khabarovsk"  homeId="6874"  awayName="Avtomobilist Ekaterinburg"  awayId="9708"  score="1-1"  foul="0-0"  status="PF"  nots="--"  startDate="11:00"  startDateStamp="1210101100"  titleName="2012-2013 Russia KHL League" timerMin="-" tvId="99998474" scoreSet=" 2 1- 0 1" scoreHeader=" 1 2" /><match id="678066" seasonId="2369" groupId="0" fixId="678066" sprotTypeId="12"  homeName="Salavat Yulaev"  homeId="5502"  awayName="AK Bars Kazan"  awayId="9091"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="16:00"  startDateStamp="1210101600"  titleName="2012-2013 Russia KHL League" timerMin="-" tvId="99998476" scoreSet="-" scoreHeader="." /><match id="678067" seasonId="2369" groupId="0" fixId="678067" sprotTypeId="12"  homeName="Spartak"  homeId="5504"  awayName="Vityaz"  awayId="5507"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="18:30"  startDateStamp="1210101830"  titleName="2012-2013 Russia KHL League" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /><match id="678064" seasonId="2369" groupId="0" fixId="678064" sprotTypeId="12"  homeName="Atlant Moscow"  homeId="9068"  awayName="Avangard"  awayId="5493"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="18:30"  startDateStamp="1210101830"  titleName="2012-2013 Russia KHL League" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /></sportType><sportType id="17" name="Hendbol"><match id="704863" seasonId="2540" groupId="0" fixId="704863" sprotTypeId="17"  homeName="KIF Kolding"  homeId="9701"  awayName="Viborg HK"  awayId="8478"  score="0-0"  foul="0-0"  status="SCH"  nots="--"  startDate="19:30"  startDateStamp="1210101930"  titleName="2012-2013 Danish Handball League" timerMin="-" tvId="0" scoreSet="-" scoreHeader="." /></sportType></sportTypes></xml>

bu kodu php ile ekrana tablo şekilde dökülecek sıra ile ve sonra bunları ben veritabanına kayıt edeceğim. Kayıt etmekte sıkıntı yok. Ancak bunları tablo ile ekrana dökemedim. Araştırdım vs... Bu konuda yardım edebilecek olan varsa sevinirim.
 

redblue58

Katılımcı Üye
26 Ocak 2008
910
2
İzmir
Kod:
 if( ! $xml = simplexml_load_file('xml adresi'))
	
	{ 		
		echo "Xml okunamadı. *****@gmail.com ile iletişime geçiniz...";		
	} 
    else
	 
    { 
		
    /*** Ana Kategori İD ve tiplerini alıyorum ***/ 
	
	$i = 0;
	
	foreach($xml->sportTypes as $node) {
				
		$sportTypes_lastCounter = $xml->sportTypes[$i]->attributes()->lastCounter;
		$sportTypes_total = $xml->sportTypes[$i]->attributes()->total;
		 
		 echo "<table width=100% border=1 ><tr><td>	
		 - ".$sportTypes_lastCounter." - ".$sportTypes_total."
		</td></tr></table> 
		 ";
	
		 $z = 0;
		 
		 
		 /*** Kategoriyi çevirmeye ve iç kategorileri çekmeye başlıyorum ***/
		  
			 foreach($xml->sportTypes[$i]->sportType as $xml->sportType[$y]->match[$z]) { 
				 
				
				 $match_homeName = $xml->sportTypes[$i]->sportType[$y]->match[$z]->attributes()->homeName;  
				 $match_awayName = $xml->sportTypes[$i]->sportType[$y]->match[$z]->attributes()->awayName;
				 
				 echo "--- ".$match_homeName." - ".$match_awayName."";
		
				 $z++;
			  
			 }
		  
		$i++;
		
	}
		
}
Çözüldü arkadaşlar. Bu mesajı bu sorunu yaşayanlar için paylaşıyorum.
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.