Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Сети > Parse cookie header


Автор: mido 4.5.2010, 02:07
Hi i need your help in reading / parsing cookies entry ;

let's take this cookie text :

//************************************************************//
__utma
95979358.1395260604.1270034198.1270034198.1271243355.2
speedbit.com/
1600
3693996222
30218515
3943881123
30071746
*
__utmz
95979358.1270034198.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
speedbit.com/
1600
1564981312
30105644
2708999424
30068931
*
__utmb
95979358.1.10.1271243355
speedbit.com/
1600
461544704
30071751
3943881124
30071746
*

//************************************************************//

i want to read the __utma , __utmz , __utmb  values .

let me suppose that such a cookie is found in Firefox i can read it in this way :

Код

procedure TForm1.Button1Click(Sender: TObject);
var
  db: TSQLiteDatabase;
  table: TSQLIteTable;
 
begin
lv.Clear;
  db := TSQLiteDatabase.Create('..\cookies.sqlite');
  try
    if db.TableExists('moz_cookies') then
    begin
      table := db.GetTable('SELECT name, value,host, path, expiry FROM moz_cookies');
      try
        while not table.EOF do
        begin
          with Lv.Items.Add do
          begin
{ caption will get __utma , __utmz , __utmb  values } 
            caption := table.FieldAsString(table.FieldIndex['name']);
            subItems.Add(table.FieldAsString(table.FieldIndex['value']));
            subItems.Add( table.FieldAsString(table.FieldIndex['host']));
            subItems.Add(table.FieldAsString(table.FieldIndex['path']));
          end;
          table.Next;
        end;
      finally
        table.Free;
      end;
    end;
  finally
    db.Free;
  end;
end;



so  __utma , __utmz , __utmb  values  will be in name  field from moz_cookies table , so i can easly read them .

But how to get them from IE cookies .

many thanks 

Автор: mido 4.5.2010, 22:03
many thanks , i did it .

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)