I don't think you will get much help here for this type of question. If you look at the responses to this recent node, you will see why.
This can be done with LWP and the information needed is in the LWP modules docs. However, I wouldn't use your site for numerous security reasons. If your script is for personal use, I am sure that there are a few people who could help.