Read server-side JavaScript from PHP
<p>I have a JS library file of variables (caption strings) used by <em>server-side</em> JavaScript. Can I read/interpret that from PHP?</p>

<p>The path to the data isn't the issue, but whether PHP can read/use the JS variables. Currently I've the same variable stored in both a JS file and PHP include with obvious scope for changes getting out of synch. I've tried reading the PHP from the <em>server-side</em> JS without joy but was wondering if - with suitable parsing - if PHP could extract/use the JS variables.</p>

<p>I repeat <em>all</em> data involved is <em>server-side</em> on the same server. Sorry if I've missed this being answered before but PHP/JS questions are (even if mis-titled) seemingly all about passing data between client and server side processes - which isn't my scenario.</p>

<p>Later - clarification:</p>

<p>The s/s JavaScript is part of a web interface to an image database where I can't alter the API. It doesn't support creating emails (for file requests) thus I am having to do that via PHP. Work scope/budget precludes re-writing a new d/b interface, rather we 'just' ned to be able to send an email. IOW, I realise you wouldn't choose to be trying to do this if starting from scratch! Also, I don't think I can do s/side AJAX to fetch variables or do PHP smtp mail as the JS environment seemingly isn't designed for that degree of s/s processing pre HTML page delivery.</p>
