Voting

: seven minus four?
(Example: nine)

The Note You're Voting On

Avee
16 years ago
I made a bit of code that sees whether a file served via RTSP is there or not:

<?php
function rtsp_exists($url) {

$server = parse_url($url, PHP_URL_HOST);
$port = "554";
$hdrs = "DESCRIBE " .$url ." RTSP/1.0"."\r\n\r\n";

//Open connection (15s timeout)
$sh = fsockopen($server, $port, $err, $err_otp, 15);
//Check connections
if(!$sh) return false;
//Send headers
fputs($sh,$hdrs);
//Receive data (1KB)
$rtds = fgets($sh, 1024);
//Close socket
fclose($sh);

return
strpos($rtds, "200 OK") > 0;
}
?>

<< Back to user notes page

To Top