April 24, 2024, 11:20:34 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


"Read" cookies

Started by JoaoAfonso, December 10, 2008, 10:08:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JoaoAfonso

Hello everyone.

How can I read a cookie file properly? I am trying to do a simple app to retrieve cookie information having a cookie file, but using a text editor, it shows the info coded...

Thanks in advance!
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

Ionic Wind Support Team

They are different formats for each browser.  A quick search on Yahoo or Google might help.

Here is Opera's cookie file format:

http://www.opera.com/docs/fileformats/

Couldn't find anything quickly about the others.
Ionic Wind Support Team

pistol350

I remember a "cookie manager application" written by sapero a few years ago.
The source of this application is somewhere in my archives.
If i ever manage to find it, i'll post it here.
Regards,

Peter B.

JoaoAfonso

I would thank you for that :)

Thanks for the answers too
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

JoaoAfonso

Ok, found the cookie manager you spoke in old ibasic archive.
Thanks!
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

sapero

Joao, for IE cookies you can use InternetGetCookie function if you know the URL. You can also enumerate all stored cookies starting from FindFirstUrlCacheEntry.
$include "windowssdk.inc"
$include "wininet.inc" ' InternetGetCookie
$include "shlwapi.inc" ' UrlUnescape

string szCookie
cch = 256
result = InternetGetCookie("http://www.ionicwind.com/forums/", 0, szCookie, &cch)

select (result)
case 0
' optional - replace all %xx to characters
UrlUnescape(szCookie, szCookie, &cch, URL_UNESCAPE_INPLACE)
MessageBox 0, szCookie, ""

case ERROR_NO_MORE_ITEMS
MessageBox 0, "There is no cookie for the specified URL", ""

case ERROR_INSUFFICIENT_BUFFER
MessageBox 0, "The szCookie buffer is too small", "" ' cch = required size
endselect

pistol350

Quote from: JoaoAfonso on December 11, 2008, 10:31:58 PM
Ok, found the cookie manager you spoke in old ibasic archive.
Thanks!

Yes, it's that one.
Anyway, just a note for those who may not know.
It's Ibstd code so it won't compile with Ebasic.
Try with Cbasic instead.

I gathered more or less all the files required to get the program compiled properly.
I may forgot one file or more as i did not try to compile the program.
I also included a compiled version of the program.
A version more recent than what you may have if you compile the current code.
Unfortunately, I do not have the source of that version.
See the zip attached to my post.
Regards,

Peter B.