/    Sign up×
Community /Pin to ProfileBookmark

Dynamic update of web page

Hi Pyro and Everyone,

I am a newbie to PHP.

I want to read data (text) from a website (hosted by somebody else) that contains LIVE information (gets updated/refreshed every 30 secs or so) and then I want to include that data (text) into HTML code of my webpage.

In short, how can I read text (LIVE football scores) from an already existing web page (I have no control on it’s source code) and then update my web page with the same scores in HTML table fields ?

The source web page looks like this::
[url]http://sports.espn.go.com/ncf/scoreboard[/url]

From there I just want to extract the scores, quarter#, time left info. and add it to a table in my destination webpage which looks something like this::

[url]http://web.engr.oregonstate.edu/~gawande/MastersProject/HTML-Files/Atlantic-Coast.html[/url]

Thanks, in anticipation,
-K-

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@pyroSep 19.2003 — Try something like this:

[code=php]<?PHP

$contents = file("http://sports.espn.go.com/ncf/scoreboard");

$lines = "";
foreach ($contents as $line) {
$lines .= $line;
}

$games = preg_split("/<!-- GameKey: (\d*) -->/", $lines);

# $games is an array of all the scores.
# Note that the index 0 contains all the code up to the first game, so we don't need that one...
echo $games[1];

?>[/code]
×

Success!

Help @gawande spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...