如何在Windows上使用WAMP运行PHP Simple HTML DOM Parser?

dmu*_*muk 1 php parsing dom wamp

我目前正在运行安装了WAMP的Windows 7.

我正在尝试安装PHP Simple HTML DOM Parser(http://simplehtmldom.sourceforge.net/)来运行以下代码.

我收到致命的错误消息.这很可能是因为DOM Parser未安装或未安装在正确的位置.

如何安装Parser?我只是将其复制到WAMP文件夹中,还是从php文件中调用它?

错误:

 Fatal error: Call to undefined function file_get_html() in     
 C:\wamp\www\PHP_SCRAPER\_jobs\jobs_dom.php on line 4

<?php 
Run Code Online (Sandbox Code Playgroud)

码:

// Create DOM from URL or file
$html = file_get_html('http://www.google.com');

// Find all images 
foreach($html->find('img') as $element) 
       echo $element->src . '<br>';

// Find all links 
foreach($html->find('a') as $element) 
       echo $element->href . '<br>';

?>     
Run Code Online (Sandbox Code Playgroud)

Mat*_*ttt 7

<?php

// Include the php dom parser    
include_once 'path_to_php_dom_parser.php';

// Create DOM from URL or file

$html = file_get_html('http://www.google.com');

// Find all images 
foreach($html->find('img') as $element) 
       echo $element->src . '<br>';

// Find all links 
foreach($html->find('a') as $element) 
       echo $element->href . '<br>';

?> 
Run Code Online (Sandbox Code Playgroud)

您需要将解析器脚本从存储它的位置包含在服务器上