MSP
MSP

Reputation: 57

How to get live score of match with runs per ball of over without refresh page like cricbuzz using php or API

I had requirement to show updated score,runs per ball of over in my website so I had followed some tutorials on youtube ,so score which Iam getting in xml file but that too updated score is getting after refresh page so i want update like cricbuzz.com implemented that way score, runs per ball so please help me how to do that using php i know upto this level so please guide me how to do this.

<?php 
$content=file_get_contents('http://static.cricinfo.com/rss/livescores.xml');


$x=new SimpleXmlElement($content);



 echo "<table border=1>";
foreach($x->channel->item as $entry){
echo "<tr>";
echo "<td><a href=$entry->link target='_blank'>";
echo $entry->description;

echo "</a></td>";

echo "</tr>";
}
echo "</table>";


?>

ouput:

output which i am getting by using this code

Upvotes: 0

Views: 4490

Answers (1)

anshuVersatile
anshuVersatile

Reputation: 2068

for live score you need socket connec5tion to api server which will send you live score on your php page. you are trying to use http call which is only single way.. for socket connection you can refer https://github.com/roanuz/php-cricket

or search socket api for cricket score

Upvotes: 1

Related Questions