PHP新手,尝试从其他网站提取信息
正如所指出的,在PHP新手,尝试从其他网站提取信息,php,web-scraping,Php,Web Scraping,正如所指出的,在中的“和”之间缺少一个,您首先得到的是页面内容吗?@JoãoRafael如果有的话,OP应该得到这个错误消息警告:preg_match():在…中找不到结尾匹配分隔符“>”我可以通过将>包含到匹配项中来获取数据:“@JoãoRafael Good catch.站点加载对我来说很好。不确定OP希望从中获得什么信息。我想他希望提取“下一个匹配项”,如果是,则只是“>”:) <?php $content = file_get_contents('http://na.lolespo
中的“
和”
之间缺少一个
,
您首先得到的是页面内容吗?@JoãoRafael如果有的话,OP应该得到这个错误消息警告:preg_match():在…中找不到结尾匹配分隔符“>”
我可以通过将>包含到匹配项中来获取数据:“@JoãoRafael Good catch.站点加载对我来说很好。不确定OP希望从中获得什么信息。我想他希望提取“下一个匹配项”,如果是,则只是“>”:)
<?php
$content = file_get_contents('http://na.lolesports.com/season3/split2/schedule');
preg_match('<time datetime="(.*)"', $content, $match);
$match = $match[1];
echo "$match";
?>
<?php
$content = file_get_contents('http://na.lolesports.com/season3/split2/schedule');
preg_match('<time datetime="(.*)">', $content, $match);
$match = $match[1];
echo "$match";
?>