【发布时间】:2015-02-25 16:21:39
【问题描述】:
我希望从我已经使用 file_get_contents 获取的页面源代码中动态创建的 URL 中提取 file_get_contents 信息。例如:
$link = $_POST['link'];
$html = file_get_contents('http://www.somesite.com/keywords='.$link."");
$output = file_get_contents(
//A URL that is in the output of $html
);
基本上我希望 PHP 加载一个 HTML 页面,然后单击该页面上的链接,然后获取生成的源代码,这样我就可以将其中的一些解析为变量以供以后使用。有什么想法吗?
【问题讨论】:
-
不确定您到底遇到了什么。只需使用
$html并获取您需要的链接。如果您不知道如何操作,则需要提供一些file_get_contents('http://www.somesite.com/keywords='.$link."");返回的示例。 -
如何在不存储任何内容的情况下“稍后使用”?
-
@Bang 问题是“将其中一些解析为变量以供以后使用”
标签: php html regex file-get-contents