title: How to download files from website using PHP with Python
body: <p>I have a Python script that crawls various webistes and downloads files form them. My problem is, that some of the websites seem to be using PHP, at least that's my theory since the URLs look like this: <a href="https://www.portablefreeware.com/download.php?dd=1159" rel="nofollow noreferrer">https://www.portablefreeware.com/download.php?dd=1159</a></p>
  <p>The problem is that I can't get any file names or endings from a link like this and therefore can't save the file. Currently I'm only saving the URLs.</p>
  <p>Is there any way to get to the actual file name behind the link?</p>
  <p>This is my stripped down download code:</p>
  <pre><code>r = requests.get(url, allow_redirects=True)
  
  file = open(&quot;name.something&quot;, 'wb')
  file.write(r.content)
  file.close()
  </code></pre>
  <p>Disclaimer: I've never done any work with PHP so please forgive any incorrect terminolgy or understanding I have of that. I'm happy to learn more though</p>