如何捕获ConsoleExport Firebug扩展发送的XML数据包?

时间:2011-12-16 23:17:38

标签: firefox firebug logging

我已经安装了ConsoleExport Firebug扩展程序。我通过将about:config设置为extensions.firebug.consoleexport.active,在true启用了自动导出功能。我打开了一个包含JavaScript错误的页面,例如http://www.random.org。我启用了Firebug,重新加载了页面。我可以在日志中看到错误:

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
  • Firefox 8.0.1
  • Firebug 1.8.4
  • ConsoleExport 0.5b4

如果抓取XML数据包的服务器更容易在那里设置,我可以访问Windows和Linux机器。

2 个答案:

答案 0 :(得分: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);
?>

洪扎

答案 1 :(得分:1)

听起来它只是通过AJAX请求将XML数据发送到该URL。 因此,您需要定义一个处理该XML数据的脚本。

E.g。当您使用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内容的参数的名称,并删除{{1}阻止。

作为参考: Firebug discussion group提出了同样的问题。