Download A File

I have a script in /cgi-bin/. I want it when called to download a dynamic file, actually an image to a file on the server. Basically pull a graph from whats actually a router of mine, save it to /temp_images. I have tried using: "system "/usr/bin/wget..." with no luck. Can someone give me a shove in the right direction? I cannot seem to find