Skip to content

Instantly share code, notes, and snippets.

@Kudratullah
Created September 4, 2014 20:27
Show Gist options
  • Save Kudratullah/cef5c591bd0afa687ee6 to your computer and use it in GitHub Desktop.
Save Kudratullah/cef5c591bd0afa687ee6 to your computer and use it in GitHub Desktop.
Get Remote File Type Via PHP CURL
<?php
# the request
$file = file_get_contents('http://www.videojs.com/js/video-js.swf');
$file_url = 'http://www.videojs.com/js/video-js.swf';
echo "<br>";
$ch = curl_init($file_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
# get the content type
echo curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
echo "<br>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment