私はPHPを使用しshell_exec()
て、コマンドラインを介してプログラムを実行し、パラメーターとしてURLを渡します。
問題:プログラムは、パラメーターの切り捨てられたバージョンのみを受け取っているようです。PHPはパラメータを渡します
http://www.mysite.com/Men/T-Shirts-Vests/Cat/pgecategory.aspx?cid=7616&parentID=-1&pge=0&pgeSize=200&sort=1
しかし、プログラムはそれを次のように受け取ります
http://www.mysite.com/Men/T-Shirts-Vests/Cat/pgecategory.aspx?cid=7616
後に切り捨てられないようにするにはどうすればよい&
ですか?
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);
出力
http://www.mysite.com/Men/T-Shirts-Vests/Cat/pgecategory.aspx?cid=7616