ruipgil / scraperjs

A complete and versatile web scraper.
MIT License
3.7k stars 188 forks source link

why i am getting saved as false when i run script using PHP #79

Open shakticmexpertise opened 6 years ago

shakticmexpertise commented 6 years ago

I am writing very simple script of scraper and i want to run this script using PHP. i have written below code for php.

$response = exec('node /home/user12/index.js > /home/user12/my_app_log.log 2>&1');
print_r($response);

this is returning response like this:

[ Resource {
    url: 'https://stackoverflow.com/questions/39505659/executing-nodejs-script-file-in-php-using-exec',
    filename: 'index.html',
    type: null,
    depth: 0,
    parent: null,
    children: [],
    saved: false } ]

you can see i am getting saved:false but the same index.js file i run from terminal i got saved:true with html contents. what i am missing here could you please help me.