I use this code to get info about webpages and files before download.
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_NOBODY, 1);
curl_exec($curl);
if (curl_getinfo($curl, CURLINFO_HTTP_CODE) == 200)
{
echo $info['active'] = true;
echo $info['url'] = $url;
echo $info['size'] = curl_getinfo($curl,CURLINFO_CONTENT_LENGTH_DOWNLOAD);
echo $info['type'] = curl_getinfo($curl,CURLINFO_CONTENT_TYPE);
}
else
echo 'not active';
It works for file or urls format like this:
www.example.com/film.mp4
www.example.com/film.php
but not works without extension name in URL..it return me 'not active';
www.example.com/film
www.example.com/film/test
how can I fixed it?
UPDATE:
it retun 403 error with CURLINFO_HTTP_CODE