WinInet...

Hi,

Actually, with an "old" XE3 delphi application, I download (open and 
save) html page. Everything worked well until some modifications has 
been made on server side. Now, from the web, I receive an html page that 
contains script tags at the end of the html code that generate the list. 
Here is the script tag

<script>
	$('#top').css('box-shadow', 'none');
	var c1 = "<h3>Countries list</h3><table class='table 
table-striped'><thead><tr><th width='36'></th><th width='30'>ISO</th><th 
width='217'>Country name</th><th width='170'>Data</th><th 
width='95'>Format</th><th 
width='190'>Name</th><th>Comments</th></tr></thead>...</table>";
	var c2 = "<h3>North America</h3><table class='table 
table-striped'><thead><tr><th width='36'></th><th width='30'>ISO</th><th 
width='217'>Country name</th><th width='170'>Data</th><th 
width='95'>Format</th><th 
width='190'>Name</th><th>Comments</th></tr></thead>...</table>";

	$(window).bind('hashchange', function(e) {
		var tab = location.hash;
		if (tab!="") tab = tab.replace("#", ""); else tab = "countries";
		if (tab == "countries")  { $('#ctry1').addClass('active'); 
$('#ctry2').removeClass('active'); $('#countries_list').html(c1); }
		if (tab == "continents") { $('#ctry1').removeClass('active'); 
$('#ctry2').addClass('active'); tab = "countries"; 
$('#countries_list').html(c2); }
		changeTab(tab);
		$('li').removeClass('menu-sel');
		$('#tab_'+tab).addClass('menu-sel');
	});
	$(window).trigger('hashchange');
</script>

As I can see, the trigger do the job (generate the right list) after the 
html page has been loaded.

What I would like to know is how can I force to run this trigger from my 
WinInet.InternetOpenUrl to have the latest (and right) html page in my 
buffer ?

Here is my WinInet routine :

   hSession := WinInet.InternetOpen(CTE_USER_AGENT, 
INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0);
   // INTERNET_OPEN_TYPE_PRECONFIG  does'nt work for me
   // 
-------------------------------------------------------------------------
   if Assigned(hSession) then
   try

     // Force a Download of the requested file --> INTERNET_FLAG_RELOAD
     // 
-----------------------------------------------------------------------
     hDownload := WinInet.InternetOpenUrl(hSession, PChar(AUrl), nil, 0, 
INTERNET_FLAG_RELOAD, 0);
     if Assigned(hDownload) then
     try
       dwCode := 0;
       dwCodeLen := SizeOf(dwCode);
       dwReserved := 0;
       WinInet.HttpQueryInfo(hDownload, HTTP_QUERY_STATUS_CODE or 
HTTP_QUERY_FLAG_NUMBER, @dwCode, dwCodeLen, dwReserved);
       if (dwCode = 200) or (dwCode = 302) then
       begin
         AssignFile(hFile, AFileName);
         try
           Rewrite(hFile, 1);
           while (WinInet.InternetReadFile(hDownload, @Buffer, 
SizeOf(Buffer), dwBytesRead)) and (dwBytesRead <> 0) do
           begin
             BlockWrite(hFile, Buffer, dwBytesRead, dwBytesWritten);
             Application.ProcessMessages;
           end;
         finally
           CloseFile(hFile);
           Result := True;
         end;
       end
       else
         Self.ProgressionMsg(psError, SysUtils.Format(CTE_ERR_WININET, 
['HttpQueryInfo (Error code ' + IntToStr(dwCode) + ')', AUrl]));
     finally
       WinInet.InternetCloseHandle(hDownload);
     end
     else
       Self.ProgressionMsg(psError, SysUtils.Format(CTE_ERR_WININET, 
['InternetOpenURL', AUrl]));
   finally
     WinInet.InternetCloseHandle(hSession);

Thank you for your help.
Regards,

Laurent
0
laurent
3/16/2015 7:19:02 PM
embarcadero.delphi.winsock 1874 articles. 2 followers. Follow

3 Replies
984 Views

Similar Articles

[PageSpeed] 22

laurent wrote:

> What I would like to know is how can I force to run this trigger from
> my WinInet.InternetOpenUrl to have the latest (and right) html page
> in my buffer ?

There is nothing you can do.  You are requesting a URL and it is sending 
you some HTML.  The fact that the HTML contains client-side scripting is 
irrelevant to the download.  The download is complete once the end of the 
HTML has been reached.  The script has to then be parsed/executed separately. 
 WinInet is not going to do that for you.

-- 
Remy Lebeau (TeamB)
0
Remy
3/16/2015 8:40:35 PM
Thank you Remy for your fast response.
So, if WinInet cannot help me in this task, is there another way to 
accomplish this kind of request ?



On 16/03/2015 21:40, Remy Lebeau (TeamB) wrote:
> laurent wrote:
>
>> What I would like to know is how can I force to run this trigger from
>> my WinInet.InternetOpenUrl to have the latest (and right) html page
>> in my buffer ?
>
> There is nothing you can do.  You are requesting a URL and it is sending
> you some HTML.  The fact that the HTML contains client-side scripting is
> irrelevant to the download.  The download is complete once the end of the
> HTML has been reached.  The script has to then be parsed/executed separately.
>   WinInet is not going to do that for you.
>
0
laurent
3/16/2015 8:55:10 PM
laurent wrote:

> So, if WinInet cannot help me in this task, is there another
> way to accomplish this kind of request ?

As I already mentioned earlier, you will have to parse the HTML script after 
you have downloaded it.  You won't be able to execute it outside of a browser 
environment without a lot of extra setup in your code, though.  So you may 
have to resort to downloading the URL with an actual browser and then wait 
for the script to execute before you can then grab the final HTML from the 
browser's DOM.

-- 
Remy Lebeau (TeamB)
0
Remy
3/16/2015 11:34:21 PM
Reply:

Similar Artilces:

Wininet vs. Winsock
Sorry, this could be a stupid question. I have been using wininet for FTP and HTTP sessions. It seems that I could also use winsock. What are the differences between wininet and winsock? When should I use winsock rather than wininet? wininet rather than winsock? I could be trying to compare apples with oranges, so forgive me if I do not make sense. Thanks in advance, Philippe ...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

delphi.internet.winsock
I was having some issues with XanaNews so I went to the Emb web version and was getting... delphi.internet.winsock - group not available. The server is throwing HTTP Status 500. Anyone else having trouble with newsgroups. Many other groups seem ok. -- Ray El 02/02/2014 8:05, Raymond Alexander escribió: > I was having some issues with XanaNews so I went to the Emb web version > and was getting... > > delphi.internet.winsock - group not available. > > The server is throwing HTTP Status 500. > > Anyone else having trouble with newsgroups. ...

delphi.internet.winsock: text and base64
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --JivePart=_18c8b.zeB8CwDOH5aMJzMl Content-Type: text/plain; charset="Utf-8" See message in delphi.internet.winsock group. --JivePart=_18c8b.zeB8CwDOH5aMJzMl Content-Type: image/jpeg; name="buffer1.JPG" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="buffer1.JPG" /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zN...

Delphi 2009
I've done some searching on the web, and i can't seem to find any answer to the problem i have. The client is made in c++ using winsock send & recieve. The server is done with Indy IdTCPServer component. When the winsock client connects, IdTCPServer get knowledge of it. However, when the winsock client sends a chararray with the function send(), nothing gets parsed in IdTCPServer.Execute. I know the client works, since i built a winsock testserver for the occation. However when using Acontext.Connection.IOHandler.ReadLn it does not. Is it known that Indy vs winsock base do...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi 5 To Delphi 2009
I upgraded to Delphi 2009 from D5. The install says I can install Delphi and/or C++. Delphi installed OK but I see nothing of C++. What am I missing or does my upgrade not include C++? Thanks It depends on what you bought. If you bought Delphi 2009 only, that's what you get. If you bought Delphi 2009 and C++ Builder 2009 you get both. My guess is you got Delphi 2009 only. The simplest way to verify is look your invoice - it should say I would think. You could also go to members.embarcadero.com, login, then click on my registered products. There will be a textual description of...

Delphi 2007 to Delphi 7
I've written a class in Delphi 2007 that is not supported in Delphi 7. What would be the best way to achive what I've done in Delphi 2007 in Delphi 7? Thanks, Tom type BondConstants = class { Bond Types } type BondType = record const TREASURY = 3; AGENCY = 0; CORP = 1; MUNI = 2; SBA = 5; MBS = 4; CMO = 6; end; { Day Count Methods } type DayCount = record const ACTUAL_360 = 2; ACTUAL_365 = 1; ACTUAL_ACTUAL = 1; d30_360 = 0; ...

Delphi 7 to Delphi XE2
Hi, Still using that old workhorse, Delphi7, but am going to the conference in London hosted by Embarcadero on Delphi XE2. Although I would like to "move with the times" and am keen to get the UNICODE and 64-bit support offered by the latest IDEs, I confess to being more than a little scared about all the UNICODE/String/AnsiString and 32/64 bit issues I'm probably going to fall over. Anyone recently upgraded from Delphi7 to one of the latest Delphi IDEs? Thanks, Alain On 03/02/2012 08:55, Alain Dekker wrote: > Still using that old workhorse, Delphi7, but am going to the conference in > London hosted by Embarcadero on Delphi XE2. > > Although I would like to "move with the times" and am keen to get the > UNICODE and 64-bit support offered by the latest IDEs, I confess to being > more than a little scared about all the UNICODE/String/AnsiString and 32/64 > bit issues I'm probably going to fall over. Anyone recently upgraded from > Delphi7 to one of the latest Delphi IDEs? I recently upgraded a sizeable (Paradox) app from D3 to XE2 and was pleasantly surprised. About 20-30 hours once I understood how XE2 works. Andrew -- Andrew Gabb email: agabb@tpgi.com.au Adelaide, South Australia phone: +61 8 8342-1021 ----- Recently moved a lexicographic application from D2007 to XE2 with little pain. As you would imagine, it is heavily string-based, with much use of TStringLists, cuttin...

Delphi for PHP or Delphi PRISM
Hi, I have the opportunity to develop a web-based library management system. Nothing fancy, just being able to do the usual CRUD stuff for books and provide a search facility. Borrowing is to be done via an email request to the library admin who then sends out the book(s). Since both Delphi for PHP and Delphi PRISM will enable me to develop the app, which one will allow me to deliver it in less time and also increase (even how small) my marketability as a web developer? Thanks. Phillip Flores Phillip Flores wrote: > Hi, > > I have the opportunity to develop a...

Delphi 7 to Delphi XE
Have been using Delphi 7 for many moons ( have got later versions but never upgraded to ) My first problem is: Component Palette. in XE it is a small toolbar docked in top right in Delphi 7 it gives a large view of all the components. I am struggling to be able to cope/access my components.in Delphi XE. Can I make the component pallette tool bar the same size as Delphi 7, or is there a fast way to view/choose all available components in XE, that I have not spotted yet? Kind Regards, Robert. Hi, What I know is that in Delphi 2010 and XE you can choose between t...

from delphi 6 to delphi 2010
Hi. It is possible, with component RX, dxforumlibrary, InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. Thank by comments. excequiel arostica wrote: >Hi. > It is possible, with component RX, dxforumlibrary, >InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. > >Thank by comments. Rx is dead and sources are taken over by jcl/jvcl. I dont know about the rest of the components and i have no experiences with bde over the last 9 years. excequiel arostica wrote: > Hi. > It is possible, with component RX, dxforumlibrary,...

Delphi 4 to Delphi 2009
Hello, Thanks to all who answered my previous question. That was a great help. And atlast our client agreed to upgrade our delphi version from 4 to Delphi 2009. *Sigh*. But before that, I need to give the estimation and cost regarding the migration to delphi 2009. Can anyone tell me is there any tool to migrate from delphi 4 to delphi 2009 or just I need to compile our Delphi 4 application in Delphi 2009. I have read from the delphi 2009 feature matrix that Delphi 1 through Delphi 2007 import is possible in delphi 2009. But i am not that sure considering the size of our application. ...

Delphi XE / Delphi 2010
Hello! I noticed that Embarcadero® Delphi® 2010 Version is not on the list of products on Embarcadero page. Or is it still possible to buy it? Will RAD Studio XE compile programs written in Delphi 2010 without problems.? Thanks. Am 13.09.2010 09:04, schrieb Petra Nemec: > Will RAD Studio XE compile programs written in Delphi 2010 without problems.? As always you will probably have to recreate the projects as the import is still a bit -- special. Christian Hello! Does anybody know if it is still possible to get a Delphi2010 trial version (if yes where)? ...

Delphi 5 to Delphi 6 and up
Dear List, Trying to add 7Zip compression support to my delphi application. I am using the ported 7Zip sdk (see their website, they have a link). I am stumped on how to rewrite a single function: function ReverseDecode(var Models: array of SmallInt; ....): ..... where the input is mostly a fixed size array of SmallInt. This code perfectly compiles and functions in Delphi 6 and up, but in Delphi 5 I get the error: There is no overloaded version of 'ReverseDecode' that can be called with these arguments And obviously, the input (fixed) isn't the same as the param definition (dynamic sized). However, my question is just as obvious: How do I rewrite this function so it will behave correctly in Delphi 5? (If this is even possible) I hope I don't have to overload it to something like: function ReverseDecode(var Models: array[0..xxx] of SmallInt....... Thanks in advance for any assistance, Rory Rory Slegtenhorst wrote: > Dear List, > > Trying to add 7Zip compression support to my delphi application. > I am using the ported 7Zip sdk (see their website, they have a link). > > I am stumped on how to rewrite a single function: > > function ReverseDecode(var Models: array of SmallInt; ....): ..... > > where the input is mostly a fixed size array of SmallInt. > This code perfectly compiles and functions in Delphi 6 and up, but in > Delphi 5 I get the error: There is no overloaded version...

Delphi and virus, or virus and Delphi.
Hi all. There is some discussion about a 'new' virus, that targets Delphi (and developers). The article is in danish: <http://www.version2.dk/artikel/11833-delphi-udviklere-jages-af-ny-type-malware> but refers to this article: <http://news.cnet.com/8301-27080_3-10312628-245.html> From the Danish article POV, it seems like Delphi itself is vunerable, which is not true. As far as i can see, is the attack vector, injection of (source) code in the 'Sysconst' unit. What's going on? -- Best regards Stig Johansen Perhaps checking other thre...

Delphi 4 to Delphi 2007
Hello, I will have to port a D4 application (with source) to D2007. what kind of problem could I face ? I will have to go to customer site tommorow to analyse its source code to quote the work, what should I care of to hestimate the porting time ? Thanks John Terry wrote: > Hello, > I will have to port a D4 application (with source) to D2007. > what kind of problem could I face ? > I will have to go to customer site tommorow to analyse its source code > to quote the work, what should I care of to hestimate the porting time ? You can probably do it by just changi...

Delphi 5 to Delphi XE4
Thinking about making the conversion. Of course we have numerous components such as: TurboPower AsyncPro, TurboPower Orpheus ICS2 Synactis All-In-The-Box. You guys have any advice as to the effort and time it may possibly take. It is a large application, several hundred thousand lines. And that's what happens when using third party components, a lot of extra work. I have been burned a few times. I now minimize the use to a few well known suppliers, like TMS. I have "banned" a lot of other components. Regards, Ole > > Thinking about making the conver...

Delphi 7, 2007, 2009 and wininet.dll https certificates
I am using TIEHTTP (iehttp3.pas) in https mode with the appropriate certificates installed. Below is the component in use:- IEHTTP1.BlockingMode:= True; IEHTTP1.MultipartPOST:= True; IEHTTP1.AddMultipartFormFile(sRec.Name, sRec.Name); IEHTTP1.ExecuteURL('https://xxx.xxx.xxx.xxx/process.asp'); Question: When server requests Certificate from connection am I rightly to conclude that the wininet.dll will locate the matching installed certificate on my PC transparently and use it accordingly ? If not would someone be so kind as to advise how to go about this. Thanks for your...

[Delphi] send custom packet from DLL ( winsock ) from DLL-Form [Edit]
hello! i`we hooked winsocket recv-send! in DLL i have form who popup on dlls inject sucess and i need send custom packet to 'Send" from my form how it be posibly?? send(s,buf,len,flags); - dont work its work if i send it only from "DLL" if i use it in my DLL-"form" then nothing happens in DLL - sock:=s; Fla:=flags; in DLL"form" send(sock,buf,len,fla); dont work to.. meybe i do it wrong? .. Thank you! <Ronaldo DeVinche> wrote in message news:136126@forums.codegear.com... > i`we hooked winsocket recv-send! ...

Delphi
Has anyone done xpcom with a Delphi plugin? If so could you eventualy provide a little example which demonstrates xpcom under delphi? kind regards Mike ...

Winsock
I have been trying to convert my Winsock nvo from PB10 to PocketBuilder 2.0.4 with the latest EBF applied. All I do is call wsastartup from the window open and wsacleanup from window close. When the program exits, I get this messagebox twice: Memory Error Freeing previously freed memory or freeing using different anchor! Generate GPF? [Yes] [No] Has anyone had any luck with Winsock? Hi Roland, we use winsock functions and all works fine. PK 2.0.4.940 Here are my function declarations: FUNCTION int htons ( uint hostshort ) LIBRARY "winsock.dll" FUNC...

wininet
Hi all can anyone help me with any example of wininet library? I have tried l' example download from topwiz software. Work fine in the powerbuilder , but in pocketbuilder when i try to connect me return 0 . This is the code: String ls_null, ls_result SetNull(ls_null) long iul_session iul_session = InternetConnect(iul_internet, as_servername, & INTERNET_DEFAULT_FTP_PORT, as_userid, as_password, & INTERNET_SERVICE_FTP, 0, 0) If IsNull(iul_session) Or iul_session = 0 Then ls_result = this.of_GetLastError() End If Return ls_result The value ...

Winsock
Is in posible to use Winsock in ASP.NET? and if, how? Richard You'll find better ways of communication than winsock API working with ASP.NET. Depending on your application, it will be much better to use XML web services and/or GET/POST/SOAP for transmission. I've elaborated this concept with usage of Win32 Internet Extensions (WinInet) in the following article. The Evolution of Web Services http://www.15seconds.com/Issue/021029.htm You may find companion source useful too. -Adnan Masood-Adnan MasoodMCSD.NET, MCAD.NET, MCPwww.DotNetSmith.com"Beware of bugs in the abov...

Delphi
Successfully ported IBuySpy in Delphi, Almost ported in MySql See it on www.giacomo.cc Bye! Hi, Is it open source??H. G. Sajnani. MCSD.net, MCDBA, MCSE. Max Virtual, LLC Computer Science Applications. ...

Web resources about - WinInet... - embarcadero.delphi.winsock

Internet Explorer xx.yy website issue
... provided the workaround. Either you can use it, or you can wander the Internet, trying to find another solution. Since I've reviewed the WinINET ...

Gopher (protocol) - Wikipedia, the free encyclopedia
The Gopher protocol / ˈ ɡ oʊ f ər / is a TCP/IP application layer protocol designed for distributing, searching, and retrieving documents over ...

Microsoft long-life bugs
... they were updating feeds. So FeedDemon's builder, Nick Bradbury , did a bit of digging and discovered that Microsoft has known about the WinInet ...

Recipe languages « ActiveState Code
Skip to Search Skip to Navigation Skip to Content Community - Code - Docs - Downloads ▼ Stackato ActivePerl ActivePython ActiveTcl ActivePerl ...

Win32/64:Napolar: New Trojan shines on the cyber crime-scene
In recent weeks, malware samples resolved as Win32/64:Napolar from AVAST’s name pools generated a lot of hits within our file and network shields. ...

Hancitor Goes the Extra Mile on the Onion Route
We have recently came across a piece of malware which is known as HanciTor (as ESET-NOD32 calls it) or Chanitor (based on the detection name ...

TorrentLocker Ransomware Cracked and Decrypter has been made
Page 1 of 2 - TorrentLocker Ransomware Cracked and Decrypter has been made - posted in News: ** Visitors looking for just the Decrypter and not ...

The Patents I Never Filed…Multicast Networks, Personalized Streaming and Advertising and Self Service ...
... if tracert is over 250ms, then a warning is issued. The software then reads the hardware config, the cpu config, who the ISP is from the Wininet, ...

General Protection Fault
A blog about DirectShow, Network, and Windows Programming Techniques

Casaba Security »
Preface: by removing these checks for HTTPOnly you are making cookie management less secure within the process. This is for testing/tools only ...

Resources last updated: 3/7/2016 4:27:22 PM