doing a search on the left hand side for fsockopen() gives quite a few results with examples people have had problems with, and the fixed versions.
searching for the same at www.php.net also gives about 10 posts from users, from one liners to a post which containers several examples.