Why doesn't my php exec () in the bash tidy command open a file?

Please carry me (I'm just learning how to use php). I can’t understand if my error is related to the tidywrong command wgetor on its own. I thought my wget command grabs the remote file and puts it in my $ link directory on my server ... but something seems to be wrong.

I tried

  • changing $ tidy_cmd to single quotes
  • string concatenation to "..." . $htmlDir . "/*";
  • not including "/*"
  • using php tidy commands (commented ... failed).

Mistake:

Error: cannot open "app / HtmlPages / arl.server.com-2015_11_19_15: 36: 09 / arl.server.com / index.php / art"

wget.php:

    $ip = $argv[1];

    // Get the current time for the filename
    $currentTime = date( 'Y_m_d_H:i:s' );
    $link = "app/HtmlPages/$ip" ."-". "$currentTime";             
    $htmlDir = "$link/$ip/index.php/art";

    // Use wget to download aaron.htm webpage
    $wget_cmd = "wget -P $link/ http://$ip/index.php/art/aaron.htm";

    exec ( $wget_cmd );

    // Clean up the HTML for every page.
    $tidy_cmd = "tidy -config tidy_config.txt -i -m $htmlDir/*";
    exec ( $tidy_cmd );

    //$tidy_config = file_get_contents( 'tidy_config.txt' );
    //$tidy = new tidy();
    //$tidy->parseFile( '$htmlDir/*.htm', $tidy_config );
    ...
+4
source share
1

, $htmlDir (.. wget.php), (,/home/yourname/yourfolder/and/so/on/). tidy, , , .. . , , !

, , . , tidy. $ php test_script.php , , !

+1
source

Source: https://habr.com/ru/post/1616629/


All Articles