Can I have a detail explain about how can I replace with tag with current attr using php?
I read manual and some referencs
How to use php preg_replace to replac
It is almost never a good idea to use regular expressions for HTML. Consider DOM, then something like:
foreach($dom->getElementsByTagName('script') as $script) {
$temp = $dom->createElement('temp');
/*
* create src attribute, append it to $temp and copy value from $script
* I leave that up to you.
*/
$script->parentNode->replaceChild($temp, $script);
}