I'm trying to create a function that checks if users have flash on there website. So far I have this:
$html = file_get_contents('http://www.test.com'); //users website
if(preg_match(".swf", $html, $matches)) {
print("<pre>");
print_r($matches);
print("</pre>");
}
But I don't get any results. Anyone got ideas? :)
<?php
$html = file_get_contents('http://www.disneylandparis.nl/'); //users website
$subject = $html;
$pattern = '/.swf/S';
preg_match($pattern, substr($subject,3), $matches);
print_r($matches);
Ruub, as Shankar Damodaran has suggested adjusting the regex works.
Instead of searching for .swf
, you could search for this text flashplayer
, since most flash developers add this line of text since if the client browser has no flash installed , they use this URL to redirect the browser. So you can rely on this as of current scenario.
This URL will be there on most of the flash websites..
<a href="http://get.adobe.com/flashplayer/?promoid=JZEFT" id="Download_AdobeFlashPlayer">Don't have Flash ? Get Adobe Flash Player Here</a>
EDIT :
Go with strpos
instead.
<?php
$htmlsrc=file_get_contents('http://www.disneylandparis.nl');
if(strpos($htmlsrc,'flashplayer')!==false)
{
echo "This website uses flash !";
}