So I have this auto-generated HTML file. http://pastebin.com/mTMJNrdm
I'm trying to write a PHP script that replaces line 5 with this.
<LINK href="style.css" rel="stylesheet" type="text/css"></style>
I'm trying to wrap my head around it since it's a file. What function could accomplish this for me?
Current code:
$fh = file('standings.html');
$css = addslashes('<LINK href="style.css" rel="stylesheet" type="text/css"></style>');
$pattern = "</style>";
foreach ($fh as $lines) {
if (preg_match($pattern, $lines)) {
// Replace this line with $css
}
}