I'm trying to use ereg_replace() with the contents of a shockwave flash movie (.swf), to replace URLs within...I've tried using it on a string which is pretty much similar
e.g. "http://www.domain.com _blank" and the regex works fine, but when it comes to replacing the same string in the binary file, it seems to only return the last 3 characters, which is "180"...strange.
Is there anything wrong with the code, or does ereg_replace() not like binary data?
<?php
$url = 'http://www.domain.com/';
$fp = readfile("Button.swf", "rb");
$repcon = ereg_replace("(http)(.*)(_blank)","$url \3",$fp);
$nfp = fopen("Button2.swf","wb+");
fputs($nfp,$repcon);
fclose($nfp);
?>