Cookie reading with MBS Plugin?

Hi all!

Has anyone tried to read or parse a cookie with Xojo using MBS Plugins?

How much difficult is, so I want to have more info in order to learn how to catch Xml files created on the fly by the webService inside a cookie.

Any thoughts?

Read cookies?
from where? the bakery?

We have a couple of classes for HTMLViewer to get cookies on Mac, Windows and Linux.
Or get Cookies when using CURL Plugin.

[quote=197874:@Christian Schmitz]Read cookies?
from where? the bakery?

We have a couple of classes for HTMLViewer to get cookies on Mac, Windows and Linux.
Or get Cookies when using CURL Plugin.[/quote]
LOL I want to catch Cookies from my HTMLViewer and then read the content of the cookies in order to find files inside of it.

[quote=197874:@Christian Schmitz]Read cookies?
from where? the bakery?

We have a couple of classes for HTMLViewer to get cookies on Mac, Windows and Linux.
Or get Cookies when using CURL Plugin.[/quote]
Sorry for my newbieness, Where Can I find that Classes?

Ok I’m Studying it, Its part of MBS Classes and Plugins. How can I find the current displayed Website on my HTMLViewer with CURL?

the first thing is to check what platforms you need (Mac, Win with IE, Win with WebKit/Chromium, Linux with Webkit?

for Windows with Chromium (WebKIt) you can use this class:

ChromiumCookieManagerMBS
https://www.monkeybreadsoftware.net/classes.shtml

for Linux with webkit we also have a class:

LinuxWebCookieStoreMBS class
https://www.monkeybreadsoftware.net/class-linuxwebcookiestorembs.shtml

and the NSHTTPCookieStorageMBS class for Mac:
https://www.monkeybreadsoftware.net/class-nshttpcookiestoragembs.shtml

[quote=198026:@Christian Schmitz]for Linux with webkit we also have a class:

LinuxWebCookieStoreMBS class
https://www.monkeybreadsoftware.net/class-linuxwebcookiestorembs.shtml

and the NSHTTPCookieStorageMBS class for Mac:
https://www.monkeybreadsoftware.net/class-nshttpcookiestoragembs.shtml[/quote]

OOOOH, Thanks, I’ll Try it. My Idea is to have an HTMLViewer in my app developed with Xojo.
And the final goal is to run it on Windows, Linux and Mac.

Ok I’m playing with NSHTTPCookieStorageMBS class for Mac.

I have two questions:

1)When I’m watching a website, Is it using Safari?
2)This class gets all the cookies stored on the system?

Thanks

I notice that in fact with this code using the Plugin, It the shared cookies:

// query list of all cookies in shared storage
dim cookies(-1) as NSHTTPCookieMBS = NSHTTPCookieStorageMBS.sharedHTTPCookieStorage.cookies

// we collect values
dim list(-1) as string
for each cookie as NSHTTPCookieMBS in cookies
List.Append cookie.name+": "+cookie.value
next

// and display them
'MsgBox join(list, EndOfLine)

Galleta.text = join(list, EndOfLine)

But what about If I have the Cookies of an Specific Website?

What about this?: dim cookies(-1) as NSHTTPCookieMBS = NSHTTPCookieStorageMBS.cookiesForURL

How Is the way to use it?

Thanks

I’m gonna try with this: dim cookies(-1) as NSHTTPCookieMBS = NSHTTPCookieStorageMBS.sharedHTTPCookieStorage.cookiesForURL(sitio)

where sitio is: http://myexamplewebsite.com

Thanks Christian.
Very useful, yes i test it NSHTTPCookieMBS to get the cookie for certain Url loaded in a HTMLViewer.

I ve read about cookies, and i know that its composed by three elements:

  1. Name
  2. Value
  3. Zero or another attribute.

But my doubt now is how can I get these third element?
Thanks

NSHTTPCookieMBS has a properties dictionary.
Does it have what you need?

Hi all, Hi Chris!

I solved the part of processing Cookies on Mac, but now for Windows, I can’t use a HTMLViewer on “WebKit” renderer, Cuz I’m using it with “Native” Renderer in order to use ChristianPlugins to execute Javascriptcode and sent to the document.title.
and then get it back with IEMBSTitle.

At this point I’m fine

but Some time before you told me about ChromiumCookieManagerMBS but it requires to be in “Webkit mode” right??

So I know that a cookie is a header right?
I dunno if is it possible to get the Header or cookie of the current website on HTMLViewer using an HTTPSecureSocket and HTTPSecureSocket.GetHeaders ( URL As String )

But I’m not very sure how to use it.

Also I tried to get Cookies using javascript with document.cookie, but nothing happens.

Any suggestions??

Also some time ago told me about CURLSMBS and I know that is posible to get a list of cookies with CURLSMBSList
and list method but how can I use it?

Thanks

You mix a lot of things here.

With CURL you can set cookies before your transfers, than do some queries and on the end ask for the current cookies list. That’s good for doing web services.

For IE we have IECookieMBS to get current cookie for current page.

For Chromium we do have the manager class to get all cookies.

http://www.w3schools.com/jsref/prop_doc_cookie.asp

[quote=235315:@Christian Schmitz]You mix a lot of things here.

With CURL you can set cookies before your transfers, than do some queries and on the end ask for the current cookies list. That’s good for doing web services.

For IE we have IECookieMBS to get current cookie for current page.

For Chromium we do have the manager class to get all cookies.[/quote]
Ok Chris I got it. Thanks

Yes Michel I’ve read this document from w3schools.

I unserstand that when I do Document.cookie. (in my case i used window.title and ExecuteJavaScript and with EvaluateJavaScript from MBS) i will get in a string all cookies stored, separated by a semicolon “;”

But I cant get Nothing.
I dunno if should be because the website that I,m browsing is a Secure Site.

Do i need to do a special procedure in this case?