Hi Php Masters. I am using this code to get score update from xml file... <?php $html = ""; $url = "http://static.cricinfo.com/rss/livescores.xml"; $xml = simplexml_load_file($url); for($i = 0; $i < 3; $i++){ $title = $xml->channel->item[$i]->title; $link = $xml->channel->item[$i]->link; $description = $xml->channel->item[$i]->description; $pubDate = $xml->channel->item[$i]->pubDate; $html .= "<p style='margin-bottom:8px; padding-bottom:2px; border-bottom:1px solid #E9E9E9;'>$title </p>"; } echo $html; ?> Now I wan to get score from this xml file http://synd.cricbuzz.com/j2me/1.0/livematches.xml How Its possible..? answer with just one match score thanks..
I'm left with a LOT of questions about that code -- like why you would call a fixed number of items, why you are manually buffering output in a variable, why you are making all those extra variables for NOTHING, and even the markup has 'issues' like why you'd have presentational STYLE bloating the output and what makes a "title" a paragraph? (if that's all you're outputting, axe 3/4ths the code and make those LI... of that's a incomplete snipped, those should likely be numbered headings) So to gut that down... <?php echo ' <h2>Scores</h2> <ul>'; $xml = simplexml_load_file('http://static.cricinfo.com/rss/livescores.xml'); $max = count($xml->channel->item) > 3 ? 3 : count($xml->channel->item); for ($t = 0; $t < $max; $t++) echo ' <li>',$xml->channel->item[$t]->title,'</li>'; echo ' </ul>'; ?> Code (markup): ... as to your question -- I don't see any scores in that second XML file to be pulled. There are NO scores in that file whatsoever.
First of all thanks for your help.. Sir may be you didn't see score in second XML.. here I have going to show the second XML code... <mchdata NMchs="9"><links fUrlBase="http://synd.cricbuzz.com/j2me/1.0/flags/team_"/><match id="1" type="T20" srs="Champions League T20 2013" mchDesc="JAI vs CHN" mnum="1st Semi-Final" vcity="Jaipur" vcountry="India" grnd="Sawai Mansingh Stadium" inngCnt="1" datapath="http://synd.cricbuzz.com/j2me/1.0/match/2013/2013_CLT20/JAI_CHN_OCT04/"><state mchState="inprogress" status="CHN elect to field" TW="Chennai" decisn="Fielding" addnStatus="" splStatus=""> </state><Tm id="64" Name="Rajasthan" sName="JAI" flag="0"/><Tm id="58" Name="Chennai" sName="CHN" flag="0"/><Tme Dt="Oct 04 2013" stTme="14:30" enddt="Oct 04 2013"/><mscr><inngsdetail noofovers="50" rrr="0" crr="7.57" cprtshp="15(7)"/><btTm id="64" sName="JAI"><Inngs desc="Inns" r="29" Decl="0" FollowOn="0" ovrs="3.5" wkts="1"/></btTm><blgTm id="58" sName="CHN"> </blgTm></mscr></match><match id="2" type="ODI" srs="ICC World Cricket League Championship" mchDesc="AFG vs KEN" mnum="ICC World Cricket League Championship" vcity="Sharjah" vcountry="United Arab Emirates" grnd="Sharjah Cricket Association Stadium" inngCnt="2" datapath="http://synd.cricbuzz.com/j2me/1.0/match/2012/ICC_LEAGUE_CHAMP/AFG_KEN_OCT04/"><state mchState="complete" status="Afghanistan won by 7 wkts" TW="AFG" decisn="Fielding" addnStatus="" splStatus=""> </state><Tm id="96" Name="AFG" sName="AFG" flag="1"/><Tm id="14" Name="Ken" sName="KEN" flag="1"/><Tme Dt="Oct 04 2013" stTme="05:00" enddt="Oct 04 2013"/><mscr><inngsdetail noofovers="50" rrr="0" crr="4.61" cprtshp="64(59)"/><btTm id="96" sName="AFG"><Inngs desc="Inns" r="96" Decl="0" FollowOn="0" ovrs="20.5" wkts="3"/></btTm><blgTm id="14" sName="KEN"><Inngs desc="Inns" r="93" Decl="0" FollowOn="0" ovrs="43.3" wkts="10"/></blgTm></mscr></match><match id="12967" type="ODI" srs="ICC World Cricket League Championship" mchDesc="AFG vs KEN" mnum="ICC World Cricket League Championship" inngCnt="2" datapath="http://synd.cricbuzz.com/j2me/1.0/match/2012/ICC_LEAGUE_CHAMP/AFG_KEN_OCT04/"><state mchState="Result" status="Afghanistan won by 7 wkts"> </state><Tm id="96" Name="AFG" sName="AFG" flag="1"/><Tm id="14" Name="Ken" sName="KEN" flag="1"/><Tme Dt="Oct 04 2013" stTme="05:00" enddt="Oct 04 2013"/></match><match id="13045" type="ODI" srs="Ryobi One-Day Cup 2013" mchDesc="SAUS vs VIC" mnum="3rd Match" inngCnt="2" datapath="http://synd.cricbuzz.com/j2me/1.0/match/2013/2013_RYOBI_CUP/SAUS_VIC_OCT04/"><state mchState="Result" status="Victoria won by 6 wkts"> </state><manofthematch NoOfPlayers="1"><mom Name="Cameron White"/></manofthematch><Tm id="158" Name="South Australia" sName="SAUS" flag="0"/><Tm id="52" Name="VIC" sName="VIC" flag="0"/><Tme Dt="Oct 04 2013" stTme="23:30" enddt="Oct 04 2013"/></match></mchdata> Code (markup): Now tell me how I can score from this XML.. file..? Here is using the ID Value system.. Check out.. again.. http://synd.cricbuzz.com/j2me/1.0/livematches.xml I want to get score from this link http://synd.cricbuzz.com/j2me/1.0/livematches.xml
Hello, Take a look on our item, it might be what you searching for : https://zumset.com/product/product/world_cup_livescore_script.html . The script is auto update and does not require a database !