2011-12-19 107 views
1

使用phpQuery我必须从网页获取的一些数据。我想用phpQuery为that.when我尝试的例子数据抽象

require_once('phpQuery/phpQuery.php'); 
phpQuery::browserGet('http://www.google.com/', 'success1'); 
function success1($browser) { 
    $browser 
    ->WebBrowser('success2') 
    ->find('input[name=q]') 
     ->val('search phrase') 
     ->parents('form') 
     ->submit(); 
} 
function success2($browser) { 
    print $browser; 
} 

我得到一个错误消息像

Fatal error: Class 'phpQuery' not found in /var/www/TantraProjects/Testing/pregmatch.php on line 4 

我无法知道这是phpQuery类不存在或别的东西。

+0

phpQuery.php在哪里保存?它必须是'include_path' – 2011-12-19 12:24:31

回答

0

这显然是一个问题,PHP引擎无法找到你的phpQuery文件。所以问题出在

require_once ('phpQuery/phpQuery.php'); 

line。在Testing文件夹phpQuery文件夹或文件夹TantraProjects?如果是后者,则更改:

require_once '../phpQuery/phpQuery.php';