When you say "<link>", what exactly do you have there? It should only include the
path portion of the URL. For example if the URL was
http://moo.com/hello/blah.jpg you should have
/hello/blah.jpg there.
Also you should have a
Host header. In fact since you're sending an HTTP 1.1 request it is required. Add an extra sockwrite line to your sockopen event:
sockwrite -n $sockname Host: moo.com
(where moo.com is the host portion of the URL).