Skip to content
WJunction - Webmaster Forum

how to check remote file exist via php

Status
Not open for further replies.
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.

About the author

N
Member · Joined
21
Messages
5
Reactions
3
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom