Im tring to replace a string. But it just doesnt work for some reason. Ive tried str_replace and preg_replace but neither have worked.
My script basically caches a webpage then replaces a given string. The problem is replacing the string then saving it.
Could you please help me out...
<?php
function get_inner_string($a,$b,$c)
{
$y = explode($b,$a);
$x = explode($c,$y[1]);
return $x[0];
}
$file = 'cache/94ddd435242c289003eca450b102df52.html';
$open_file = file_get_contents($file);
$find_ad = get_inner_string($open_file, '<!-- Begin: AdBrite, Generated: 2008-12-18 16:23:11 -->', '<!-- End: AdBrite -->');
str_replace($find_ad, 'new ad');
?>