Ruf1
Ruf1

Reputation: 179

How can I pass a Text string as a PHP Exec command

I am trying to pass a Text string as a variable using the PHP Exec command line, but the entire text is not being passed.

The text is like this:

$title_page = 'Channel | This is the channels title';

then the exec line is:

exec("$path_to_php $emailer $article_sub_security_var $article_id > /dev/null &");

Im retrieving them like this:

$article_sub_security_var = $_SERVER['argv'][1];
$article_id = $_SERVER['argv'][2];
$page_title = $_SERVER['argv'][3];

The command line is working properly with the exception of $page_title. It only returns part of the string and not all of it.

Any suggestions to pass it in full much appreciated.

Upvotes: 1

Views: 1863

Answers (1)

darthmaim
darthmaim

Reputation: 5158

The command line is working properly with the exception of $page_title. It only returns part of the string and not all of it.

I guess your problem is the | (pipe) in your page title, try using escapeshellcmd on $title_page before.

Upvotes: 1

Related Questions