How can you view an HTTP request in transit?

WordPress Plugin Development: Does the WP_Http_Cookie class set cookies in the HTTP request header rather than storing cookies to a file?

  • I'm checking how the http://codex.wordpress.org/HTTP_API works and wondering how it manages browser cookies. As I view the code, I cannot either find the http://php.net/setcookie function nor functions that deal with writing data to a file. So can I understand that the requesting client made by the HTTP API does not store the cookies?

  • Answer:

    I believe you maybe answered your own question? The WP_Http_Cookie class is simply what I'd call a helper class that packages cookie values into HTTP headers, it does not write headers to a disk file. WordPress uses WP_Http_Cookie when sending cookies with an HTTP request using request() methods from WP_Http and other related classes. So when you make an HTTP request with one of the WordPress API functions it is completely up to you to capture the cookie values you get from HTTP response headers and then persist them in the manner most appropriate for your use-case. However, rather than writing them to disk as a file I'd be inclined to save them as an option in the wp_options table, or as user meta in the wp_usermeta table, or as post meta in the wp_postmeta table. And which of those I'd choose would depend on the site's architecture and why I would be persisting them. Hope this helps. -Mike

Mike Schinkel at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.