• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 163
  • Last Modified:

For ITugay

This is the topic for my portal client project.
0
ginsonic
Asked:
ginsonic
  • 21
  • 15
1 Solution
 
ITugayCommented:
hi ginsonic,
I'm here
0
 
ginsonicAuthor Commented:
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
 
ginsonicAuthor Commented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ITugayCommented:
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
 
ginsonicAuthor Commented:
If interested I can send you the started project.
0
 
ITugayCommented:
no, I prefer to try it from "zero" :-)
0
 
ginsonicAuthor Commented:
Are you from Almaty ?
0
 
ginsonicAuthor Commented:
Big distance between us :)
Look on the map from 'Localizare' menu.
0
 
ITugayCommented:
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
 
ITugayCommented:
I'm going to use THttpCli from FPiette's components package. Is it acceptable?
0
 
ITugayCommented:
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
 
ginsonicAuthor Commented:
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
 
ginsonicAuthor Commented:
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
 
ITugayCommented:

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
 
ginsonicAuthor Commented:
Please send to ginsonic@csc.ro .
0
 
ITugayCommented:
done...
0
 
ginsonicAuthor Commented:
I tested and work, but read just 10 records from 27 available.
0
 
ginsonicAuthor Commented:
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
 
ITugayCommented:
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
 
ginsonicAuthor Commented:
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
 
ITugayCommented:
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
 
ginsonicAuthor Commented:
Any news?
0
 
ITugayCommented:
hi,
no news for a while :(
I have lot of work, will do something at saturday.

I hopy you not too hurry.

____
Igor
0
 
ginsonicAuthor Commented:
I can wait, no problems. Thanks for support.
0
 
ginsonicAuthor Commented:
Have some time for me to finsh this topic?
0
 
ITugayCommented:
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
 
ginsonicAuthor Commented:
More than a month ?
0
 
ITugayCommented:
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
 
ginsonicAuthor Commented:
See you later then :)
0
 
ginsonicAuthor Commented:
Look alike you don't have time for me :(

I increse anyway the points to 200 for your time spended here.
0
 
ITugayCommented:
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
 
ginsonicAuthor Commented:
Sound great (the memo). I have write an antialiased TEdit.
0
 
ginsonicAuthor Commented:
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
 
ITugayCommented:
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
 
ginsonicAuthor Commented:
Sound great. Your component will be available on net? :) Yamm :P

I just send you the codes. Hope to be helpfully.
0
 
ginsonicAuthor Commented:
My TEdit descend from TCustomControl. I just rewrite the standard component.
0

Featured Post

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!

  • 21
  • 15
Tackle projects and never again get stuck behind a technical roadblock.
Join Now