首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在XP +Apache2.2+ XDebug上调试通过cURL发送到Wordpress的Atompub帖子

如何在XP +Apache2.2+ XDebug上调试通过cURL发送到Wordpress的Atompub帖子
EN

Stack Overflow用户
提问于 2008-12-15 16:53:11
回答 2查看 1.6K关注 0票数 2

我一直使用NetBeans作为XDebug交互式调试客户端。但它似乎只支持将调试器附加到通过Firefox调用的脚本。我希望在通过cURL调用请求解析脚本时逐步执行该脚本。

EN

回答 2

Stack Overflow用户

发布于 2008-12-15 17:53:28

我想出了答案。首先,我在netbeans中右击wordpress项目并选择"debug“来附加一个调试器。这将在firefox中打开博客,并在url中包含“xdebug_START=netbeans-xdebug”参数(例如"http://localhost/wordpress/?XDEBUG_SESSION_START=netbeans-xdebug")。

然后,我从命令行调用cURL,确保使用名称/值xdebug/netbeans-xdebug设置cookie:

代码语言:javascript
复制
>curl "http://localhost/wordpress/wp-app.php/posts" -X POST -H "Content-type: application/atom+xml" -v -L -k -u admin:password --data @post_atom_entry_bad.xml -o post_bad_response.txt -b XDEBUG_SESSION=netbeans-xdebug
* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80 (#0)
* Server auth using Basic with user 'admin'
> POST /wordpress/wp-app.php/posts HTTP/1.1
> Authorization: Basic YWRtaW46d2Fuc3Vp
> User-Agent: curl/7.19.1 (i586-pc-mingw32msvc) libcurl/7.19.1 OpenSSL/0.9.8i zlib/1.2.3
> Host: localhost
> Accept: */*
> Cookie: XDEBUG_SESSION=netbeans-xdebug
> Content-type: application/atom+xml
> Content-Length: 302
>
} [data not shown]
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   302    0     0    0   302      0     74 --:--:--  0:00:04 --:--:--     0

此时,cURL在我在wp-app.php中的第283行设置的断点处暂停,AtomParser->handle_request(),我可以逐步执行代码。

单击F5 (继续)后,服务器将响应发送回cURL:

代码语言:javascript
复制
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   302    0     0    0   302      0      2 --:--:--  0:02:17 --:--:--     0< HTTP/1.1 400 Bad Request
< Date: Mon, 15 Dec 2008 17:47:06 GMT
< Server: Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.6
< X-Powered-By: PHP/5.2.6
< Content-Length: 0
< Connection: close
< Content-Type: text/plain
<
100   302    0     0    0   302      0      2 --:--:--  0:02:18 --:--:--     0* Closing connection #0


>

好了。如果能从其他交互式调试客户端(如notepad++ )获得示例,那就太好了。

票数 2
EN

Stack Overflow用户

发布于 2008-12-15 18:00:28

相关XDebug文档:http://www.xdebug.org/docs/remote#browser_session

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/369007

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档