how to check remote file exist via php

Status
Not open for further replies.

nightcat

Member
21
2012
5
0
the file is on port 881
i find this script but it only work on port 80

function check_remote_file_exists($url)
{
$curl = curl_init($url);

curl_setopt($curl, CURLOPT_NOBODY, true);

$result = curl_exec($curl);
$found = false;

if ($result !== false) {

$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($statusCode == 200) {
$found = true;
}
}
curl_close($curl);

return $found;
}
 
4 comments
Status
Not open for further replies.
Back
Top