Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
geturl2 forIntGetFile
#1
Is there a way to get the final URL from a IntGetFile call the way there is for the "web" function via geturl2?
#2
There are many ways of URL redirection. IntGetFile redirects only when used HTTP error 301 with "Location" header. Then it is possible to get the "Location" header. Example:

Macro Macro2538
Code:
Copy      Help
out
str url="http://www.quickmacros.com/test/test.php"
str html headers
IntGetFile url html 0 INTERNET_FLAG_NO_AUTO_REDIRECT 0 0 0 headers
;out html
out headers

str location
if findrx(headers "^HTTP/\S+ 301\b(?sm).+^Location: *([^\r\n]+)" 0 1 location 1)>=0
,out F"Redirected to {location}[][]"
,
,IntGetFile url html
,out html

If used other ways, IntGetFile does not redirect. But then in most cases you can extract the new location from the downloaded page HTML or headers. Then call IntGetFile again with the new location.


Forum Jump:


Users browsing this thread: 1 Guest(s)