user602558
user602558

Reputation: 1

wget embedded in php to download image

From the command line, wget http://mydomain.com/image.jpg successfully downloads the image.

The image file size is 7KB.

When I embed this code into exec(), system() or passthru(), such as

exec('wget http://mydomain.com/image.jpg');

or the same with system() or passthru()

The image gets created but only has 255 bytes...

Can anybody tell me why this happens?

Upvotes: 0

Views: 4139

Answers (1)

HBlend
HBlend

Reputation: 555

I would try using the quiet (-q) and specifying an output file (-O). It is possible its continual status updates are causing an issue.

Here is an example of grabbing google's logo that is working for me.

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

wget v1.12

php v5.3.1

Upvotes: 3

Related Questions