3

I know that this question allready has answer, but, that's not my case. I try to download the source of a webpage that is javascript enabled. The problem is that I found a solution that works from bash but not from PHP. Here is the commands(methods) I've tried so far: 1. PhantomJS Running directly command from bash works:

phantomjs get.js 'https://someurl.com/'

Running exec(and shell_exec) from php the same comand does not return the full web page but only a part of web page with a warning that "This webpage requires JavaScript..."

$command = "phantomjs get.js '".$url."'";
$string = shell_exec($command);

I've also tried to call a bash script from php that runs this command also without success.

$command = "sh t1.sh '".$url."'";
$string = shell_exec($command);

And again the same story..running directly command sh t1.sh 'https://someurl.com/ returns the full web page but calling from php not.

I've also tried Lynx with the same result:

$command = "lynx -source '".$url."'";
$string = shell_exec($command);

Above code return's a part of page that say's that javascript is required and this one works:

~]# lynx -source 'https://someurl.com/'
2

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.