Domanda

Good day all.

I have this problem, I need to download a lot of images, I have the ppossibility to use wget to achieve this, but I got some problems.

first, I have try wget itself:

system('wget -q http://www.google.com/images/logo_sm.gif -O test2.gif');

ok, it works, I can do it ... So, I changed the parameters, putting the real URL and a subdirectory where to save:

system('wget -q -nH '.$row['foto'].' -O ./img/'.$row['modello'].'.jpg');

that is been parsed in:

wget -q -nH http://server.com/main.php?action=exec&task=show_image&task_arg=23456&m=not&ft=product_full_image_1&auth=d84a122342332ff2d1dssssff06d0199 -O ./img/0561142.jpg

this time I get a werid result, something like a thousands 11 bytes files called main.php?action=exec### have been created in the same directory of the script (note that ### is a 3 digit number ).

I understand that there is something wrong...maybe url parameters? maybe the subdirectory? what I'm messing? is system the god choiche? or maybe exec is better? or whatever?

thanks in advance.

È stato utile?

Soluzione

Ampersand, and other characters, has special meaning in shell syntax. If you really can't use PHP's built-in cURL library you should at least escape the shell options before adding them to the command.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top