Link to home
Start Free TrialLog in
Avatar of stOrM
stOrMFlag for Germany

asked on

Question about idhttp GET

I've seen an interesting posting here: https://www.experts-exchange.com/questions/23286908/Downloaded-files-using-TIdHTTP-INDY-10.html

Where I could get a filename for an url which looks like this: http://www.deadlybossmods.com/download.php?id=1

the problem is, it does not result any filename if the url looks like this one: http://www.delphipages.com/edit/count.cfm?ID=3338

can someone make it work with most if not all urls?

kindest regards
s!
ASKER CERTIFIED SOLUTION
Avatar of 2266180
2266180
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stOrM

ASKER

Hi ciuly,
maybe I did a mistake but if I execute your code, I run into an exception telling me:

'EIdHTTPProtocolException HTTP/1.1.302 Object Moved'

kindest regards
s!
that only happens when running in the IDE and not having the delphi exceptions ignored :)

so, either run it from outside of the ide, or, in ide, menu, tools - debugger options - language exceptions : uncheck stop on delphi exceptions.
Avatar of stOrM

ASKER

Ah I see, perfect job!
Thank you very much!

Maybe one last word, does this version you have done now works with all of those urls which hides filenames or is it alsmost impossible to extract every one?

kindest regards
s!
can't say. if the methods used are standardized and are the 2 which I implemented, then yes :) there might be other standard ways of doing it. when you find one, just ask and we'll solve it ;)
Avatar of stOrM

ASKER

Ok I'll look if I stumble about another one, I'll let you know!
Again thank you very much!

s!
you're welcome
Avatar of stOrM

ASKER

Hi ciuly,
I didn't thought I would come back so fast but try this url: http://go.microsoft.com/FWLink/?LinkId=84399
for the example above it will not generate the filename :-(
it works for me
Avatar of stOrM

ASKER

Hmm don't know why probably my mistake I got as filename result: _LinkId_84399 instead of wuredist.cab
yes, in first instance. but when doing the get, it will redirect (302) which will give the new url and thus changing the filename from _LinkId_84399 to wuredist.cab

unless you changed something in the code :P

run my code as it is (only change the url) and you will see it works.
Avatar of stOrM

ASKER

seems to be something with my other code inside the thread not sure whats wrong in the moment i need more testing
tae your time. just keep in mind that according to EE rules, since you are having another problem, even though it is related to this question, you need to open a new question because it is actually another problem ;)
there is an ask a related question link just above the memo box you type in, this one: https://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/newQuestionWizardRelated.jsp?qid=23860762
Avatar of stOrM

ASKER

Ok I'll see I now found the problem myself.
While running your code inside a seperate thread, I was freeing the MemoryStream and IDHHTP Object not inside the thread execution but in destroy. That was my mistake so the downloaded file couldn't be saved to hdd!
I now moved the freeing of both objects into the finally statements in thread execute method and it works like a charm!

kindest regards
s!