The best way to find out what is going on between your PC and the remote website in terms of networking is to go download an application such as Wireshark and have a look at the packet exchanges when you run your script.
Depending on how deep you want to go, the key protocols involved will be TCP as the transport and HTTP as the application-layer protocol.