Tuesday, 15 September 2015

php - Is it possible to str_replace or preg_replace the output of a javascript call? -



php - Is it possible to str_replace or preg_replace the output of a javascript call? -

this question has reply here:

what difference between client-side , server-side programming? 6 answers

i have page calls content page 3rd party using javascript. need preg_replace or str_replace output purposes of translating few words (ie days of week english language spanish). here illustration of javascript call:

<script language="javascript" src="http://www.example.com/?id=100&amp;site=1&amp;plugin=result_type1&amp;<?= $queryparams ?>"> </script>

the js outputs results html table. possible? don't have more code because wouldn't know how go starting this.

any help appreciated.

presumably script loading injects html elements page. 1 time page has loaded, utilize browser view source see elements these , attributes have.

one way of achieving want str_replace on innerhtml property of element want. trigger event <body onload="doreplace()"> doreplace function write handle str_replace.

i'm assuming don't have command on resource injecting. if do, far improve translation before injection rather live on page. if don't, run risk of changes injected code ruining doreplace function without notice.

otherwise, can seek downloading script , changing suit needs. can utilize customized script on pages need customized output.

php javascript preg-replace str-replace

No comments:

Post a Comment