Neither of these are working cry

First one won't display any results at all. Second snippet returns Socket 4 error. Anybody else have a script? My old Google search script would at least work some of the time even though I would get a lot of parser errors, however now it will not return any results.