2011-12-16 32 views
1

我已經安裝ConsoleExport Firebug擴展。通過將extensions.firebug.consoleexport.active設置爲true,我已啓用自動導出功能about:config。我打開了一個包含JavaScript錯誤的頁面,例如http://www.random.org。我已啓用Firebug,重新加載頁面。我可以看到在日誌中的錯誤:如何捕獲ConsoleExport Firebug擴展發送的XML數據包?

uncaught exception: Error: Permission denied for <https://www.facebook.com> to get property Proxy.InstallTrigger 

ConsoleExport頁說:

您也可以激活自動導出功能,在發送 單獨登錄到指定的服務器作爲XML數據包。

我知道我應該將extensions.firebug.consoleexport.serverURL設置爲服務器URL。我不知道如何捕獲ConsoleExport發送的XML數據包。

例如,我知道如何在Mac上設置Apache,但那又如何?如何捕獲XML數據包?

環境:

  • 的Mac OS X 10.7.2
  • 火狐8.0.1
  • 螢火蟲1.8.4
  • ConsoleExport 0.5b4

我有Windows訪問和Linux機器,如果捕獲XML數據包的服務器更容易在那裏設置。

回答

2

修改腳本獲取發佈數據確定一個問題:

注意,發佈數據的內容類型是application/XML

<?php 
    $filename = 'consoleexport.log'; 

    if (!$handle = fopen($filename, 'a')) 
    { 
    echo 'File "'.$filename.'" could not be opened'; 
    exit; 
    } 

    ob_start(); 
    $content = file_get_contents('php://input'); 
    $content .= "\n"; 
    ob_clean(); 

    if (!fwrite($handle, $content)) 
    { 
    echo 'Can\'t write into file "'.$filename.'"'; 
    exit; 
    } 

    echo 'Done!'; 
    fclose($handle); 
?> 

洪扎

的努力
+0

謝謝,這個腳本的作品。 – 2011-12-23 10:19:06

1

聽起來就像它只是通過AJAX請求發送XML數據到該URL。 所以你需要定義一個處理XML數據的腳本。

例如當您使用PHP時,您可以將serverURL首選項設置爲http://localhost/handleFBConsoleOutput.php。該腳本可能如下所示:

<?php 
    $filename = '/path/to/log/file/consoleexport.log'; 

    if (!$handle = fopen($filename, 'a')) 
    { 
    echo 'File "'.$filename.'" could not be opened'; 
    exit; 
    } 

    ob_start(); 
    var_dump($_POST); 
    $content = ob_get_contents(); 
    ob_clean(); 

    if (!fwrite($handle, $content)) 
    { 
    echo 'Can\'t write into file "'.$filename.'"'; 
    exit; 
    } 

    echo 'Done!'; 
    fclose($handle); 
?> 

此處顯示的代碼寫入所有POST參數的轉儲。您可能希望通過將$content變量替換爲$_POST['param_name'](其中param_name是保存XML內容的參數的名稱)並刪除ob_start(); ... ob_clean();塊來指定確切的參數作爲輸出。

作爲參考: 同樣的問題在Firebug discussion group被問到。

+0

謝謝,但看起來像一兩​​條線是錯誤的。 :) – 2011-12-23 10:20:01

相關問題