在shell_exec()中将网页内容作为字符串参数传递


Passing content of web page as string argument in shell_exec()

如果我传递字符串内容,那么它运行良好,提交时会显示结果。但是当我通过使用escapeshellarg(strip_tags($text));接收的网页内容时。它在屏幕上什么也没显示。

<?php
//sent has value "http://www.paulgraham.com/herd.html"
$url=$_POST['sent'];
$text = file_get_contents($url);
$temp=escapeshellarg(strip_tags($text));
//$temp="one two two"; If I pass $temp with string content it gives result
echo $temp;  //Echo $temp shows content of webpage 
$output=shell_exec("/home/technoworld/Videos/LinSocket/Modular/x '$temp'");
echo $output;
?>

感谢您在这里进行交流:

我得到了答案:

<?php
//sent has value "http://www.paulgraham.com/herd.html"
$url=$_POST['sent'];
$text = file_get_contents($url);
$temp=escapeshellarg(strip_tags($text));
$output=shell_exec("/home/technoworld/Videos/LinSocket/Modular/x " . $temp);
echo $output;
?>