curl-library
Re: Ubiquiti
Date: Tue, 18 Apr 2017 18:56:21 -0400
On 4/18/2017 4:08 PM, Greg Stewart via curl-library wrote:
> On Tue, Apr 18, 2017 at 07:52:35AM -0600, Greg Stewart via
> curl-library wrote:
> > I am working with Ubiquiti airMax products. I'm trying to get logged
> in and
> > change the device configuration.
>
> I actually had to do exactly that a few weeks ago. What I ended up
> doing is:
>
> I got everything working. Below I have my code which needs to be
> cleaned up. I used the --libcurl flag to produce the libcurl c code,
> and it worked great. That is an awesome feature.
>
> Since I can't save the cookie file to the ESP32 in a file format, how
> do I store the cookie and reuse it? Can I put it in a buffer?
Every e-mail reply on this topic that you've sent to the list is
starting a separate thread in my e-mail clients (Thunderbird and Yahoo),
I don't know why. It makes the conversation harder to follow.
In addition to what Daniel said, all good points, if you are storing
them in flash and that's why you need to output them to memory that is
possible. The cookies would be imported individually by setting each
cookie via CURLOPT_COOKIELIST [1] before curl_easy_perform, and then
exported all at once as a linked list via CURLINFO_COOKIELIST [2].
for(struct curl_slist *c = cookies; c; c = c->next) {
res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, c->data);
if(res != CURLE_OK) {
/* bail out, cleanup, etc */
}
}
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
/* bail out, cleanup, etc */
}
curl_slist_free_all(cookies);
cookies = NULL;
res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
if(res != CURLE_OK) {
/* bail out, cleanup, etc */
}
for(struct curl_slist *c = cookies; c; c = c->next) {
printf("%s\n",c->data);
}
[1]: https://curl.haxx.se/libcurl/c/CURLOPT_COOKIELIST.html
[2]: https://curl.haxx.se/libcurl/c/CURLINFO_COOKIELIST.html
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-04-19