Ciao a tutti,
Sto cercando un modo per scoprire se un determinato url rimanda al download di un file o meno. Attualmente sto usando
Codice PHP:
<?php print_r(get_headers("http://www.sito.com/pagina.php"1)); ?>
Il problema è che ottengo spesso risposte diverse (tre esempi):

Codice PHP:
Array
(
    [
0] => HTTP/1.1 302 Object moved
    
[Connection] => Array
        (
            [
0] => close
            
[1] => close
        
)
    [
Date] => Array
        (
            [
0] => Sun08 Nov 2009 16:37:42 GMT
            
[1] => Sun08 Nov 2009 16:37:42 GMT
        
)
    [
Server] => Array
        (
            [
0] => Microsoft-IIS/6.0
            
[1] => Apache/2.2.11 (Unixmod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
        

    [
X-Powered-By] => Array
        (
            [
0] => ASP.NET
            
[1] => PHP/5.2.9
        
)
    [
X-AspNet-Version] => 2.0.50727
    
[Content-Length] => 199
    
[Location] => htt p://www.sito2.com/altra_pagina.php
    
[Cache-Control] => private
    [
Content-Type] => Array
        (
            [
0] => text/html
            
[1] => application/octet-stream
        
)
    [
1] => HTTP/1.1 200 OK
    
[Content-disposition] => attachmentfilename=DownloadThis.exe


Codice PHP:
Array
(
    [
0] => HTTP/1.0 302
    
[Date] => Array
        (
            [
0] => Sun08 Nov 2009 16:29:11 GMT
            
[1] => Sun08 Nov 2009 16:29:10 GMT
        
)
    [
P3P] => policyref="http://info.yahoo.com/w3c/p3p.xml"CP="CAO DSP COR EA PRE LOC GOV..."
    
[Location] => htt p://64.233.167.99/DownloadThis.exe
    
[Content-Type] => Array
        (
            [
0] => text/html
            
[1] => application/octet-stream
        
)
    [
Age] => 0
    
[Server] => Array
        (
            [
0] => YTS/1.17.13
            
[1] => Apache/2.2.3 (Red Hat)
        )
    [
1] => HTTP/1.1 200 OK
    
[Last-Modified] => Sat07 Nov 2009 13:50:02 GMT
    
[ETag] => "c60192-13885-3cad5680"
    
[Accept-Ranges] => bytes
    
[Content-Length] => 80005
    
[Connection] => close


Codice PHP:
Array
(
    [
0] => HTTP/1.0 200 OK
    
[Date] => Sun08 Nov 2009 16:31:35 GMT 
    
[P3P] => policyref="http://info.yahoo.com/w3c/p3p.xml"CP="CAO DSP SAMi OTRi STA POL HEA PRE LOC GOV"
    
[Last-Modified] => Mon19 Oct 2009 20:38:07 GMT
    
[Accept-Ranges] => bytes
    
[Content-Length] => 62976
    
[Content-Type] => application/octet-stream
    
[Age] => 0
    
[Server] => YTS/1.17.13




Ciò che vorrei ottenere è: url, nome (con estensione), tipo e peso del file che viene scaricato.
Esiste un altro modo per fare questa cosa? Oppure come posso prevedere tutti i casi possibili sopra ed ottenere sempre le informazioni che mi servono?
Ringrazio in anticipo chiunque riesca a darmi una mano!