View Full Version : replace code in php output

06-19-2010, 09:26 PM
Hi all,

I have this php output:

<form><input type="submit" name="submit" value="Update Cart" class="inpSubmit"></form>

and I'm trying to replace the input of this form with str_replace:


$search = array('<input type="submit" name="submit" value="Update Cart" class="inpSubmit">');
$replace = array('<button type="submit" name="Submit"><span class="buttonSubmit"><em><b><strong>Update Cart</strong></b></em></span></button>');
$subject = array('<form><input type="submit" name="submit" value="Update Cart" class="inpSubmit"></form>');

echo str_replace($search, $replace, $subject);


But $search and $subject arrays was taken from php output, not from php source code.
Unfortunately I can't access to the source code (because it's in the engine files due to it needing to be built dynamically).

Then is it possible to replace this code in php output?

Thank you very much

06-19-2010, 11:22 PM
I at least would need more information like, do you want the change in one place or everywhere, what engine, etc.

06-20-2010, 10:39 AM
I want the change everywhere (only output is important).
The engine is ioncube (zend) encoded (but I can NOT edit the ioncube encoded files).

I was trying to add that php code (str_replace) on a page that isn't ioncube encoded but that includes an ioncube encoded file.

Unfortunately I can't edit the ioncube encoded file and I don't know its real php code.

Then maybe it's possible to replace this php output of included ioncube encoded file:

<form><input type="submit" name="submit" value="Update Cart" class="inpSubmit"></form>

Thank you very much

06-21-2010, 08:47 PM
Maybe something with ob_start?
I'm getting crazy!