title: Checking if a URL returns a PDF
body: <p>I need to check if a URL returns a PDF document using PHP. Right now I'm using the file_get_mimetype function. A normal URL(<a href="https://www.google.com/" rel="nofollow">https://www.google.com/</a>) returns type as application/octet-stream while a normal pdf link (<a href="http://www.brainlens.org/content/newsletters/Spring%202013.pdf" rel="nofollow">http://www.brainlens.org/content/newsletters/Spring%202013.pdf</a>) returns application/pdf. But now I also encounter URL's like <a href="http://www.dadsgarage.com/~/media/Files/example.ashx" rel="nofollow">http://www.dadsgarage.com/~/media/Files/example.ashx</a> or <a href="http://www.wpdn.org/webfm_send/241" rel="nofollow">http://www.wpdn.org/webfm_send/241</a> which also is pdf but returns application/octet-stream. There are other URL's too which opens a Save as dialog box which also has to be detected.</p>