I want to have something in phpproxy script. I need to also proxify javascripts too for example there is <script src="http://www.domain.name/test.js"></script> I want to have script this script proxified while surfing true this script, I want it like <script src="http://mydomain.com/q?=http://www.domain.name/test.js"></script> Code (markup): Here is the main part of that script which strip Javascripts if ($_flags['remove_scripts']) { $_response_body = preg_replace('#<\s*script[^>]*?>.*?<\s*/\s*script\s*>#si', '', $_response_body); $_response_body = preg_replace("#(\bon[a-z]+)\s*=\s*(?:\"([^\"]*)\"?|'([^']*)'?|([^'\"\s>]*))?#i", '', $_response_body); $_response_body = preg_replace('#<noscript>(.*?)</noscript>#si', "$1", $_response_body); } PHP: