0


First of all, thank you in advance to anyone who will share their experiences with me. My problem is that I need to somehow get or download the html or php file from a link or URL using Delphi(Well preferably Delphi 6 or 7). for example, i need to get the content of "test01.html" from this link "http://www.test.com/test01.html". It's like I download a file via URL.

One more thing is that, if your way was to access the URL first, then you need to know this.
for example: link is "http://www.test.com/test01.html"

test01.html content: <script>$(document).ready(function() window.location.replace("http://www.test.com/test02.html");}); </script>

test02.html content: <?php echo "hello world"; ?>

from my example above relating to my problem, if your way was to access the URL first, then I should still get the content of test01.html not the source of test02.html.

This issue is actually not related directly to idhttp.Get function.

Thank You Very Much to AnyOne.

  • 2
    Learn about TidHTTP from Indy and more specifically its `.Get` function. – whosrdaddy Dec 30 '16 at 11:50
  • 1
    "test02.html content: " - on a properly configured server you would never get it. this PHP code are the server program sources. The server sources are not leaked to you. Instead the server would EXECUTE that PHP program and give you the *end result* of that program work. – Arioch 'The Dec 30 '16 at 11:55
  • @whosrdaddy hi, I tried to use .Get via idhttp. I encounter this error "http/1.1 302 Moved Temporarily". I searched about this error and most search results say that it is a redirect issue. So i set HandleRedirect property to true. The problem is that it redirect to a different page. Relating to my example again. When I try to download test01.html, since test01.html content is a redirection to a different page, I get test02.html source instead. – Francis Carillo Dec 31 '16 at 03:46
  • If you get 302 from the webserver, then you are out of luck, there is nothing you can do about this. – whosrdaddy Dec 31 '16 at 08:37
  • @whosrdaddy is there another way. Maybe instead of downloading the actual file, is it possible to get the content or the source code of test01.html? I'm trying webbrowser now and exploring it's properties and events. Maybe with webbrowser and dom? do you have any ideas. Appreciate your help very much. – Francis Carillo Dec 31 '16 at 08:51

0 Answers0