Recent

Author Topic: https page download  (Read 941 times)

BubikolRamios

  • Sr. Member
  • ****
  • Posts: 307
https page download
« on: December 03, 2023, 06:18:50 pm »
Looks like I have all working (having libeay32.dll and ssleay32.dll),
+/- like:

Code: Pascal  [Select][+][-]
  1.     with TFPHttpClient.Create(Nil) do
  2.     try
  3.       AllowRedirect:= true;
  4.       htmlStr := Get('some https page');
  5.     finally
  6.       Free;
  7.     end;
  8.  

for instance from this page https://wiki.freepascal.org/Try , code pulls all page content, but from this not - all links missing
https://italic.units.it/flora/index.php?procedure=specieslist&key_id=6771.

EDIT: problematic link shows OK, if you scroll down here / click 'list of species'
https://italic.units.it/flora/index.php?procedure=ext_key_home&key_id=6771



Any idea ?

« Last Edit: December 03, 2023, 06:23:23 pm by BubikolRamios »
lazarus 3.2-fpc-3.2.2-win32/win64

kwyan

  • New Member
  • *
  • Posts: 25
Re: https page download
« Reply #1 on: December 04, 2023, 12:02:05 pm »
@BubikolRamios, what do you mean "all links missing"?

"list of species" is not a link. It is a HTML form and the button is a HTTP FORM POST. If you use HTTP client to get the html source of the page, you may get something like this:

<form action="index.php?procedure=specieslist&amp;key_id=6771" method="post" class="menuform">
<button style="background-color:LightSkyBlue" name="uno" type="submit"> <b><font color="#000000">List of species</font></b></button></form>


Thaddy

  • Hero Member
  • *****
  • Posts: 16194
  • Censorship about opinions does not belong here.
Re: https page download
« Reply #2 on: December 04, 2023, 02:28:34 pm »
AllowRedirects property should be true. If the page is fully gennerated on  the flly by scripting that does not work.  But downloading the page will work.
« Last Edit: December 04, 2023, 02:34:52 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

BubikolRamios

  • Sr. Member
  • ****
  • Posts: 307
Re: https page download
« Reply #3 on: December 04, 2023, 04:11:51 pm »
Allready:
Code: Pascal  [Select][+][-]
  1. AllowRedirect:= true;
  2.  

So playing a bit with browser, figured, and now it magically works. Have no idea but looks to me as Get would open session and something is written to it ? And then scanning second link = target link, works.

Code: Pascal  [Select][+][-]
  1. with TFPHttpClient.Create(Nil) do
  2.     try
  3.       AllowRedirect:= true;
  4.       //the one with button
  5.       htmlStr := Get('https://italic.units.it/flora/index.php?procedure=ext_key_home&key_id=6771');
  6.       //the one that button opens
  7.       htmlStr := Get('https://italic.units.it/flora/index.php?procedure=specieslist&key_id=6771');
  8.     finally
  9.       Free;
  10.     end;
  11.  


will look into downloading  thing ....

« Last Edit: December 04, 2023, 08:02:08 pm by BubikolRamios »
lazarus 3.2-fpc-3.2.2-win32/win64

 

TinyPortal © 2005-2018