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

时间:2013-09-02 09:25:48

标签: php 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;
?>

1 个答案:

答案 0 :(得分:0)

感谢您的光临:

我得到了答案:

<?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;
?>