用文件()获取网站的css代码

I've got this code:

$path = $site."/".$stylesheets[0] ("http://example.com/thecssfile.css")
$css = file($path);

But now, there is the sourcecode of http://example.com in the $css variable. How can I get the code of http://example.com/thecssfile.css. If I set the $path variable directly to "http://example.com/thecssfile.css" it works but I want it dynamic.

You assume, that $stylesheets[0] is thecssfile.css, but it is not. You can see this by var_dump($stylesheets[0])

You need to make sure, it has the value you want. In your case:

$stylesheets = [0 => 'thecssfile.css']