Conditions | 3 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | private function remoteFileExists($url) { |
||
11 | $curl = curl_init($url); |
||
12 | |||
13 | //don't fetch the actual page, you only want to check the connection is ok |
||
14 | curl_setopt($curl, CURLOPT_NOBODY, true); |
||
15 | |||
16 | $result = curl_exec($curl); |
||
17 | $ret = false; |
||
18 | |||
19 | //if request did not fail |
||
20 | if ($result !== false) { |
||
21 | //if request was ok, check response code |
||
22 | $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
||
23 | |||
24 | if ($statusCode == 200) { |
||
25 | $ret = true; |
||
26 | } |
||
27 | } |
||
28 | |||
29 | curl_close($curl); |
||
30 | |||
31 | return $ret; |
||
32 | } |
||
46 |