回答 1 已采纳
I have this small php code
$command = 'bash newpdftoebook.bash ' . $_POST['BookID'] . ' "' . $_POST['pdffile'] . '"';
$descriptorspec = array(
// stdin is a pipe that the child will read from
0 => array("pipe", "r"),
// stdout is a pipe that the child will write to
1 => array("pipe", "w"),
// stderr is a pipe that the child will write to
2 => array("pipe", "w")
$process = proc_open($command, $descriptorspec, $pipes, realpath('./'), array());
And this is my bash file
if [ ! -d "$dirprocessing" ]; then
echo -e "Error: there is no folder 'processing'"
if [ ! -f "$pdffile" ]; then
rm -R $rmdir
#copy from google drive to local ubuntu server *.pdf
wget -O $dirprocessing"action-$1.pdf" "$2"
It is not downloading the file, but when i execute it within the terminal the file is downloaded successfully. I am running this inside my terminal
bash /var/www/html/newpdftoebook.bash 2569
What i am doing wrong, btw this code was working fine before that, but i installed a new Ubuntu 18 machine and moved the code there and since then the code dosent work anymore. Also i have installed wget on the machine as i have test it and it is working from terminal.
回答 2 已采纳
I'm attempting to use wget with the -p option to download specific documents and the images linked in the HTML.
The problem is, the site that is hosting the HTML has some non-html information preceding the HTML. This is causing wget to not interpret the document as HTML and doesn't search for images.
Is there a way to have wget strip the first X lines and/or force searching for images?
First Lines of Content:
Last Lines of Content:
EDIT: Solutions in PHP are certainly accepted.
回答 1 已采纳
I need to download file://///220.127.116.115/dsaspdata/Dev/hotdocs/docs/12rsocz2q4.docx and if I paste it in browser it will open up a word document. I am automating it with PHP script like this - shell_exec("wget file://///18.104.22.1685/dsaspdata/Dev/hotdocs/docs/12rsocz2q4.docx -O /tmp/batch_test/final_remu.docx");
Obviously this doesn't work because file:///// is not a recognized.
In which format do I have to put it in shell_exec?