Does your proxy require authentication? For eg, if you used a browser to browse to an external website, would you have to authenticate through the proxy first?
The best way to figure out what is happening, is to install a browser extension that can sniff the HTTP requests. I use Firebug in Firefox. Enable firebug extension, then go through your scenario. In the Net tab of firebug, it will show you the requests being sent. Try to emulate the same requests in your code.
hope this helps.
feroze
--
My blog