首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用PHP从另一个网站获取描述

使用PHP从另一个网站获取描述
EN

Stack Overflow用户
提问于 2013-12-17 19:11:25
回答 1查看 125关注 0票数 3

我试图在一个使用preg_match的网站上获取这个描述,只是有问题:

这是我想要得到的东西。就在<b>Game Description:</b><br /><b>Tool v3.1 Info:之后的文本

代码语言:javascript
复制
<b>Game Description:</b><br />
Steel Diver is a new action-packed submarine combat game from Nintendo that<br />
immerses players in the 3D action with unique game controls and lush 3D<br />
environments. The player can choose from three different submarines, each<br />
with touch-screen control panels that players will have to master to guide<br />
them through treacherous undersea caverns while engaging enemy submarines,<br />
dodging depth charges and battling massive sea creatures. Steel Diver also<br />
takes advantage of the built-in gyroscope of the Nintendo 3DS system. The<br />
combination of 3D game play and one-of-a-kind controls makes for an immersive<br />
combination that must be experienced to be believed.<br />
<br />
<b>Tool v3.1 Info:

这里是我尝试过的:

代码语言:javascript
复制
    $pattern1 = '#<b>Game Description:</b><br />\s*(.*?)\s*<b>Tool v3.1 Info:#';
    preg_match($pattern1,$downloadPage,$description);
    print_r($description);

$downloadPage只是用curl打开网址,我得到了一些其他的数据,只是需要帮助这个部分。

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-12-17 19:18:08

您需要 modifier在多行上进行匹配:

代码语言:javascript
复制
$pattern1 = '#<b>Game Description:</b><br />\s*(.*?)\s*<b>Tool v3.1 Info:#s';

Demo.

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20642658

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档