Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74846

How to get session variable after forward from node?

$
0
0

I am forwarding from nodejs to an html file through code:

res.sendFile(__dirname + '/' + fileToServe);

where fileToServe is an html file. I notice that when I do this, the previous code I had in my .htaccess to interpret html files as php files does not work anymore. Therefore, I can't include php files, or php code for that matter. All I need to do is get a session variable from php. I have thought about running the php file via node through something like,

  if(fileToServe == 'index.html'){
      //php parse
    var exec = require("child_process").exec;
    app.get('/', function(req, res){exec("php index.php", function (error, stdout, stderr) {res.send(stdout);});});
  }

and then get the session variable in the mentioned "index.php," but the problem with that is that the php runs on my server, not on the client, where I need to get the php session variable from, and store.

If I simply change the index.html file name to index.php, and try to do res.sendFile on that, nodejs doesn't understand it, and therefore can't serve the file.

Any ideas greatly appreciated!

thanks,


Viewing all articles
Browse latest Browse all 74846

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>