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
Related Q & A:
- Settings options not showing up on Sub Menu page in WordPress plugin?Best solution by WordPress
- How can you view an HTTP request in transit?Best solution by Information Security
- How to delete a particular line from a file?Best solution by Stack Overflow
- How to debug HTTP request?Best solution by Server Fault
- How can I send an http request at a specific time?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.