I am using PHP's shell_exec()
to execute a program via a commandline, passing it an URL as the parameter.
Problem: The program seem to receive only a truncated version of the parameter. PHP passes the parameter
http://www.mysite.com/Men/T-Shirts-Vests/Cat/pgecategory.aspx?cid=7616&parentID=-1&pge=0&pgeSize=200&sort=1
but the program receives it as
http://www.mysite.com/Men/T-Shirts-Vests/Cat/pgecategory.aspx?cid=7616
How can I prevent it from getting truncated after the &
?
PHP
$url = 'http://www.mysite.com/Men/T-Shirts-Vests/Cat/pgecategory.aspx?cid=7616&parentID=-1&pge=0&pgeSize=200&sort=1';
$script = path('base')."application/phantomjs/httpget.js";
$output = shell_exec("phantomjs $script $url");
httpget.js
// Get URL from command line parameter
var system = require('system');
var url = system.args[1];
console.log(url);
Output
http://www.mysite.com/Men/T-Shirts-Vests/Cat/pgecategory.aspx?cid=7616