?
Solved

For ITugay

Posted on 2003-03-07
36
Medium Priority
?
161 Views
Last Modified: 2010-04-04
This is the topic for my portal client project.
0
Comment
Question by:ginsonic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 21
  • 15
36 Comments
 
LVL 9

Expert Comment

by:ITugay
ID: 8101359
hi ginsonic,
I'm here
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8102621
My portal address is http://www.construiesc.ro .
Here I have a module for estate agency (to post sell-buy-rent houses offers).

The module is freeware, but still don't have very much users (in fact I have just two). Maybe is a little complicate or need to much time to post all offers ussing my module. Who know !?  So I wish to make a client as the users to can input the offers into a database off-line and after that with a single click to record these dates into my portal database.

In same time to let the user to delete own expired offers or modify someones.
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8110493
I can untill now just to login into the portal. What to do now to can get some dates from my tables (I use mySql)?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:ITugay
ID: 8110700
Let talk more about your portal.
I guess that you have to write someting like EExpert.
To make some samples I need to know what data I have to send to portal for login and for extracting data.

Ok, let me few time, I will try to play with your portal and then let you know about results.

____
Igor
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8110970
If interested I can send you the started project.
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8111018
no, I prefer to try it from "zero" :-)
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8111063
Are you from Almaty ?
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8111096
Big distance between us :)
Look on the map from 'Localizare' menu.
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8111225
Yes, I'm from Almaty, really to far :)

Ok, I created an account and able to login.
The main problem that I do not understand site's language.

Which information you want to grab from site?

----
Igor
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8111252
I'm going to use THttpCli from FPiette's components package. Is it acceptable?
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8111549
Ok,
I make a little Delphi application.
It able to login to portal using my account and get page with a text:
"Bun venit, ITugay !"

Seems all fine.

I'm waiting for additional info.

____
Igor
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8111861
Into members section (read Pentru membri) the user must go to 'Inscriere agentie' to register as estate agency (to input identification details for this agency). If already registered then this link is changed to 'Administrare agentie' where can change company details, post new offers, modify or delete existing offers,show current and expired offers.

About THttpCli from FPiette's components is OK.
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8111930
To see an agency info  sample go to main page and click to 'Iasi'.
8<--------------
Oferte imobiliare
In bazele noastre de date sunt inregistrate 3 agentii imobiliare (Bucuresti, Iasi, Neamt) ce totalizeazã un numãr de 27 oferte.
---------------->8

This will open a list with all agencies from Iasi city, in my case a single one.

If need a test agency you can register your own and name it: 'AGENTIE TEST - PENTRU PROBE'. This will let my visitors to understand that is a phantom agency.

And if will input test offers name these as TEST1, TEST2, TEST3...
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8118437

Hi!

here is a progress.
Using my account  I able to connect to your portal and then grab data for Neamt.
I'm using my library that based on FPiette's components and also has some useful class for parsing HTML.

Data shown in memo like this:


ID 1 : 2 CAMERE ZONA PRECISTA
2
Piatra Neamt
Neamt
Apartament cu doua camere situat la etajul 1, 51mp suprafata, cu boxa.
385MIL
alabama



ID 2 : 2 CAMERE ZONA PRECISTA
2
Piatra Neamt
Neamt
Apartament cu doua camere situat la etajul 3, 54mp sufrafata, boxa mare.
13500 EURO
alabama



ID 3 : 3 CAMERE ZONA PRECISTA
3
Piatra Neamt
Neamt
Apartament lux cu 3 camere, semimobilat, centrala, termopan antiefractie, 97mp suprafata.
35.000$
alabama


..... etc .....



here is a cut-n-paste of code


type
  TForm1 = class(TForm)
    Memo1: TMemo;
    btLogin: TSpeedButton;
    btGet: TSpeedButton;
    edUser: TEdit;
    edPass: TEdit;
    edProxy: TEdit;
    edProxyPort: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    SpeedButton1: TSpeedButton;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure btGetClick(Sender: TObject);
    procedure btLoginClick(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    HS: THTTPSession;
    procedure AcceptProxySettings;
    procedure ExtractData(const S: String);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  HS := THTTPSession.Create;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  HS.Free;
end;

procedure TForm1.AcceptProxySettings;
begin
  HS.HTTP.Proxy := edProxy.Text;
  HS.HTTP.ProxyPort := edProxyPort.Text;
end;


procedure TForm1.btLoginClick(Sender: TObject);
begin
  AcceptProxySettings;
  HS.Post(
    'http://www.construiesc.ro/modules.php?name=Your_Account',
    Format('uname=%s&pass=%s&op=login', [edUser.Text, edPass.Text]));
  HS.ExtractCookies;
  Memo1.Text := HS.Cookie;
end;


procedure TForm1.btGetClick(Sender: TObject);
begin
  AcceptProxySettings;
  Memo1.Text := HS.Get('http://www.construiesc.ro/modules.php?name=Your_Account&op=userinfo&bypass=1&uname=' +
    edUser.Text);
end;


procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  ExtractData(HS.Post('http://www.construiesc.ro/modules.php?name=Imobiliare&file=index',
    'op=Offer&offercounty=30&offercategory=1&offerooms=1000'));
end;


procedure TForm1.ExtractData(const S: String);
var
  P, PD: THTMLParser;
  ST, S1: String;

  procedure ShowS1;
  begin
    S1 := Html2Str(S1);
    Memo1.Lines.Add(S1);
  end;

begin
  Memo1.Text := '';
  P := THTMLParser.Create;
  PD := THTMLParser.Create;
  P.Data := S;
  while P.CopyBetween('<table', '</table>', ST, True) do
  begin
    if Pos('clientdata=', ST) > 0 then
    begin
      PD.Data := ST;
      PD.CopyBetween('<b>', '</b>', S1, True); ShowS1;
      PD.CopyBetween('right>', '<div>', S1, True); ShowS1;
      PD.CopyBetween('right>', '<div>', S1, True); ShowS1;
      PD.CopyBetween('right>', '<div>', S1, True); ShowS1;
      PD.CopyBetween('justify>', '<div>', S1, True); ShowS1;
      PD.CopyBetween('right>', '<div>', S1, True); ShowS1;
      PD.CopyBetween('clientdata=', '">', S1, True); ShowS1;

      Memo1.Lines.Add(^M^J^M^J);

    end;
  end;

  PD.Free;
  P.Free;
end;



If you are going to continue with my code, then let me know where to send a sample and a library.

____
Igor
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8118545
Please send to ginsonic@csc.ro .
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8118603
done...
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8118785
I tested and work, but read just 10 records from 27 available.
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8118815
I'm interested more to make a tools for members (the estate agencies) and not for visitors.

I just created to your account a test agency.
Go to member section and choice 'Administrare agentie'.
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8118826
yes,

you just have to grab a rest of records by getting data from modified url.
Take a look like browser does it. Just click on next '>>' and see what happens.
You can parse current page to detect that more pages available. I think that it is not difficult. I write a sample just to show a way to go. If you'd like, then I can provide more code to parse rest of records.

____
Igor

0
 
LVL 9

Author Comment

by:ginsonic
ID: 8118847
I added 4 offers , too.

One is expired and three for buy (Cumparare), sell (Vanzare) and rent (Inchiriere).

For the first step is interesting to get and modify the agency infos.

The second step is to read all curent and expired offers.

The final step is to can add new offers, modify or delete some offers.
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8119226
Ok,
It doesnt seems as difficult, but only takes a lot of time.
I use protocol sniffer to detect what browser does to do something, then analize a packets to take a look what is necessary to send to achive the same result.

-----
Igor
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8128231
Any news?
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8133972
hi,
no news for a while :(
I have lot of work, will do something at saturday.

I hopy you not too hurry.

____
Igor
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8134040
I can wait, no problems. Thanks for support.
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8150382
Have some time for me to finsh this topic?
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8156779
Hi ginsonic
I'm sorry, I still have no time to do something for you :(

You can close this Q and refund points or keep it open.
May be I will have few time later. Not sure.

____
Igor
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8157002
More than a month ?
0
 
LVL 9

Accepted Solution

by:
ITugay earned 800 total points
ID: 8157146
Hi ginsonic
I hope that no more, I'm going to finish hot-work at the end of this week. And then get some time to do something else then a lot of incredible code.

_____
Igor
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8157773
See you later then :)
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8290382
Look alike you don't have time for me :(

I increse anyway the points to 200 for your time spended here.
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8290421
Hi ginsonic,
I'm sorry, but I'm realy have no time.
I have to finish antailased memo that shows text like in Adobe Acrobat Reader.
Deadline is next week :(
it was not necessary to increase points, but... anyway thank you :)
____
Igor
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8290472
Sound great (the memo). I have write an antialiased TEdit.
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8290486
I have some antialiased component: TListBox, TComboBox. If interested I cand send the codes to make an idea.

In my opinion isn't very hard to write this memo. Or maybe I'm wrong :)
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8290558
Hi ginsonic,
yes, it would be interesting to take a look. I hope that it's works for small font's sizes (7,8,9,10). You can send me it to igor@novell.kz.

>> In my opinion isn't very hard to write this memo.

It's about ready, and has formatting ability (color, justifying, style ...)
Most of code already done. As usual, most of concept must be reconsider before using it in real app (very iterative process)
____
Igor
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8290922
Sound great. Your component will be available on net? :) Yamm :P

I just send you the codes. Hope to be helpfully.
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8290938
My TEdit descend from TCustomControl. I just rewrite the standard component.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question