user2676857
user2676857

Reputation: 1

New to PHP, trying to extract information from another website

<?php
$content = file_get_contents('http://na.lolesports.com/season3/split2/schedule');

preg_match('<time datetime="(.*)"', $content, $match);
$match = $match[1];

echo "$match";
?>

I'm trying to use that to get the dates and times of matches, but the page just takes forever and comes up blank.

Upvotes: 0

Views: 102

Answers (1)

Funk Forty Niner
Funk Forty Niner

Reputation: 74220

As João Rafael pointed out, there was a missing > between " and ' in <time datetime="(.*)"

Reformatted code:

<?php
$content = file_get_contents('http://na.lolesports.com/season3/split2/schedule');

preg_match('<time datetime="(.*)">', $content, $match);
$match = $match[1];

echo "$match";
?>

Upvotes: 1

Related Questions