Syntactic Confectionery Delight | |
PerlMonks |
Re^5: LWP::Simple get function...by maverick (Curate) |
on Dec 17, 2007 at 16:15 UTC ( [id://657447]=note: print w/replies, xml ) | Need Help?? |
Wow, a reply to a seven year old post. Is that a record?
Your 400 error message is probably because you're using a short url: as opposed to a full url As for saving the output in a given directory; you'll need to make a couple of changes. First you'll need to make the program take two parameters, the URL you want to get and the save location. For the sake of simplicity, let's not only specifiy the directory to save in, but also the filename to save the page into. Note the differences between the two. The first "if" has changed, as well as the usage message. Then there are the added "open" and "close" statements, and the alteration to the "print" statement. Then you can use it like this: The output directory will have to exist first and the program doesn't do any sanity or security checks on the filename you give it. There are lots of references here on how to do add that sort of bulletproofing.
/\/\averick
In Section
Seekers of Perl Wisdom
|
|