You should really use the API with the random option for this -->> http://api.givesmehope.com/view/random <<-- Click this to see how simple.
HTTP/2.0?? What the $#@!? -- I always use 1.0 and if I have a problem I will change it to 1.1
Also using on sockclose to trigger the output to the channel/notice is a waste of time.
When you find the data you want in on sockread, just send it to channel/notice, close the socket, clear any variables and you are done.
On sockclose is triggered when the server/site you are connecting to realizes that you are done sending/receiving data and decides to disconnect. In some cases this can be more than a minute. I have no idea who started using on sockclose in scripts like this, but it is absolutely the wrong way to script this.
Good job for first try though jsg55 :) Probably looks better than my first one did.
Laughs @ Hope