简体   繁体   English

使用libcurl和C ++获取cookie值

[英]Getting a cookie value using libcurl and C++

I use libcurl to send a request to a page. 我使用libcurl将请求发送到页面。 And the page set a cookie on local. 并且该页面在本地设置了一个cookie。 The problem is how can I get the value of a single cookie into a variable. 问题是如何将单个Cookie的值转换为变量。 Ps I have set the tag COOKIEFILE AND COOKIEJAR 附言:我已经设置了标签COOKIEFILE和COOKIEJAR

You can export all cookies a libcurl handle keeps, using something like this: 您可以使用以下方式导出libcurl句柄保留的所有cookie:

curl_easy_getinfo (..., CURLINFO_COOKIELIST , ...) curl_easy_getinfo (..., CURLINFO_COOKIELIST ,...)

That gives you a list, then you can just scan through that list to find the one(s) you need. 这会给您一个列表,然后您可以浏览该列表以找到所需的列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM