How to set proxy programatically

I have made a new post:

Here I used PAC (Proxy Auto-config).