fileexistsexternal

Gesponsorde koppelingen

PHP script bestanden

  1. fileexistsexternal

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
function file_exists_external($url)
{

    $headers = get_headers($url);
    if(!$headers)
    {

        return FALSE; // Failure
    }
    else
    {
        switch($headers[0])
        {
            case
'HTTP/1.0 200 OK':
            case
'HTTP/1.1 200 OK':
                return TRUE; // Found
            break;

            default:

                return FALSE; // Else, nja, failure
            break;
        }
    }
}


// Usage:
# Will give: Not found! :

echo (file_exists_external('http://www.yadayadayada.com/whatever.png')) ? 'Found!' : 'Not found!';

# Will give: Found!
echo (file_exists_external('http://www.google.nl/intl/nl_nl/images/logo.gif')) ? 'Found!' : 'Not found!';

/* End of file file_exists_external.php */ [/code]

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.