in reply to html not displaying

You exit before you print. Why is the exit(0) there if you actually want to print the HTML output?

Supplementary: no strict? Why the low-level approach to connecting to the remote server?