this_page = read_html("https://apu.edu/athletics")
> this_page
{xml_document}
<html id="ctl00_html" lang="en" class=" index homepage">
[1] <head>\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n<script>window.client_hostname = "athletics.apu.edu";window.server_name = "79077 ...
[2] <body>\n<div style="position: fixed; left: -10000px"><script src="//cdn.blueconic.net/azusa.js" async=""></script></div>\n<script>(function(i,s,o,g,r,a,m){i[ ...
although we read https://apu.edu/athletics
, it redirects to athletics.apu.edu
. This is true both in the browser, and it can also be seen in the output of this_page
right here: <script>window.client_hostname = "athletics.apu.edu"; ...
Is it possible to extract this value out of the this_page
variable?
Edit: the currently top 3 answers (ekoam, David, Allan) all work, and all take ~ the same amount of time (0.35 seconds). I've accepted the answer with trace_redirects
because it provides the addt'l info of all the redirects...
If you want to get all the redirects (you are actually redirected twice here), you can use this function:
So you can do: