title: Using wget to download page within Moodle
body: <p>I understand that this might be too specific but I am still quite new and having some difficulty figuring this out. So, I am hoping someone can offer up a clear command which can achieve my goal.</p>
  <p>My goal is to download a page from Moodle. Now, this is Moodle 3.9 but I don't think this matters. The page is a wiki which is part of Moodle. So, there are child pages, links, images, etc. Now, each student gets their own wiki and it is available by URL. However, one must be logged in to access the URL or else a login page will show up.</p>
  <p>I did review <a href="https://stackoverflow.com/q/1324421/546813">this question</a>, which seemed like it would help. It even has an <a href="https://stackoverflow.com/a/23454894/546813">answer here</a> which seems specific to Moodle.</p>
  <p>By investigating each of the answers, I learned how to get the cookies from Firefox. So, I tried logging into Moodle in my browser, then getting the cookie for the session and using that in wget, according to the Moodle answer cited above.</p>
  <p>Everything I try results in a response in Terminal like:</p>
  <pre><code>Redirecting output to 'wget-log.4'
  </code></pre>
  <p>I then found out where wget-log files are stored and checked the contents, which seemed to be the login page from Moodle. While I am quite sure I got the cookie correct (copy-and-paste) I am not sure I got everything else correct.</p>
  <p>Try as I might (for a couple of hours), I could not get any of the answers to work.</p>
  <p>My best guess for the command is as follows:</p>
  <pre><code>wget --no-cookies --header &quot;Cookie: MoodleSession=3q00000000009nr8i79uehukm&quot; https://myfancydomainname.edu/mod/ouwiki/view.php?id=7&amp;user=160456
  </code></pre>
  <p>It just redirects me to the wget-log file (which has the Moodle login page).</p>
  <p>I should not need any post data since once logged into my browser, I can simply paste this URL and it will take me to the page in question.</p>
  <p>Any ideas what the command might be? If not, any idea how I could get some pretty clear (step-by-step) instructions how to figure it out?</p>