I'm trying to see if a link is a .flv file or not. So I grab only the first part of the url because it always starts with "FLV". At least that's what I get when i "echo $content;". Here is a piece of the code. $content=@ file_get_contents($url,FALSE,NULL,0,100); if (strpos($content,'FLV')===true && strpos($content,'FLV')==0) { echo 'FLV file exists.'; continue; } PHP: However i'm not getting any results. Am I doing something wrong?
strpos() doesn't ever return boolean true. It's returns boolean false if the string was not found, and the position as integer if found. www.php.net/strpos Try: if (strpos($content,'FLV') === 0) { echo 'FLV file exists.'; } PHP: