Changeset 520
- Timestamp:
- May 2, 2015 8:46:32 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r519 r520 1332 1332 } 1333 1333 } 1334 1335 /* 1336 * Returns true if the given URL resolves to a resource with a HTTP 200 header response. 1337 * 1338 * @access public 1339 * @param string $url URL to a file. 1340 * @return bool True if the resource exists, false otherwise. 1341 * @author Quinn Comendant <quinn@strangecode.com> 1342 * @version 1.0 1343 * @since 02 May 2015 15:10:09 1344 */ 1345 function httpExists($url) 1346 { 1347 $ch = curl_init($url); 1348 curl_setopt($ch, CURLOPT_NOBODY, true); 1349 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 1350 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 1351 curl_exec($ch); 1352 return '200' == curl_getinfo($ch, CURLINFO_HTTP_CODE); 1353 }
Note: See TracChangeset
for help on using the changeset viewer.