2011-12-19 101 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';